get-error.js 414 B

1234567891011121314151617
  1. 'use strict';
  2. var PACKAGE_NAME = require('../../package.json').name;
  3. /**
  4. * Get an Error instance for the given message
  5. * @param {...*} message Any number of message arguments
  6. * @returns {Error}
  7. */
  8. function getError() {
  9. var message = (PACKAGE_NAME + ':\n' + Array.prototype.slice.call(arguments).join(' '))
  10. .split(/\s*\n\s*/)
  11. .join('\n ');
  12. return new Error(message);
  13. }
  14. module.exports = getError;