Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
419 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | class ParserError extends Error {
|
---|
| 4 | constructor(message) {
|
---|
| 5 | super(message);
|
---|
| 6 |
|
---|
| 7 | this.name = this.constructor.name;
|
---|
| 8 | this.message = message || 'An error ocurred while parsing.';
|
---|
| 9 |
|
---|
| 10 | if (typeof Error.captureStackTrace === 'function') {
|
---|
| 11 | Error.captureStackTrace(this, this.constructor);
|
---|
| 12 | }
|
---|
| 13 | else {
|
---|
| 14 | this.stack = (new Error(message)).stack;
|
---|
| 15 | }
|
---|
| 16 | }
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | module.exports = ParserError;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.