SyntaxError.js 460 B

1234567891011121314
  1. var createCustomError = require('../utils/createCustomError');
  2. module.exports = function SyntaxError(message, input, offset) {
  3. var error = createCustomError('SyntaxError', message);
  4. error.input = input;
  5. error.offset = offset;
  6. error.rawMessage = message;
  7. error.message = error.rawMessage + '\n' +
  8. ' ' + error.input + '\n' +
  9. '--' + new Array((error.offset || error.input.length) + 1).join('-') + '^';
  10. return error;
  11. };