You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
460 B

4 years ago
  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. };