ParserError.js 419 B

12345678910111213141516171819
  1. 'use strict';
  2. class ParserError extends Error {
  3. constructor(message) {
  4. super(message);
  5. this.name = this.constructor.name;
  6. this.message = message || 'An error ocurred while parsing.';
  7. if (typeof Error.captureStackTrace === 'function') {
  8. Error.captureStackTrace(this, this.constructor);
  9. }
  10. else {
  11. this.stack = (new Error(message)).stack;
  12. }
  13. }
  14. }
  15. module.exports = ParserError;