1 | 'use strict';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | class CamoError extends Error {
|
9 | constructor(message) {
|
10 | super(message);
|
11 |
|
12 |
|
13 | Object.defineProperty(this, 'message', {
|
14 | enumerable : false,
|
15 | value : message
|
16 | });
|
17 |
|
18 | Object.defineProperty(this, 'name', {
|
19 | enumerable : false,
|
20 | value : this.constructor.name,
|
21 | });
|
22 |
|
23 | if (Error.hasOwnProperty('captureStackTrace')) {
|
24 | Error.captureStackTrace(this, this.constructor);
|
25 | return;
|
26 | }
|
27 |
|
28 | Object.defineProperty(this, 'stack', {
|
29 | enumerable : false,
|
30 | value : (new Error(message)).stack,
|
31 | });
|
32 | }
|
33 | }
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | class ValidationError extends CamoError {
|
39 | constructor(message) {
|
40 | super(message);
|
41 | }
|
42 | }
|
43 |
|
44 | exports.CamoError = CamoError;
|
45 | exports.ValidationError = ValidationError; |
\ | No newline at end of file |