@naturalcycles/nodejs-lib 12.49.0 → 12.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/validation/ajv/ajvValidationError.js +0 -14
- package/dist/validation/joi/joi.validation.error.js +0 -14
- package/dist/validation/joi/joi.validation.util.js +1 -0
- package/package.json +1 -1
- package/src/validation/ajv/ajvValidationError.ts +0 -15
- package/src/validation/joi/joi.validation.error.ts +0 -15
- package/src/validation/joi/joi.validation.util.ts +1 -0
|
@@ -5,20 +5,6 @@ const js_lib_1 = require("@naturalcycles/js-lib");
|
|
|
5
5
|
class AjvValidationError extends js_lib_1.AppError {
|
|
6
6
|
constructor(message, data) {
|
|
7
7
|
super(message, data);
|
|
8
|
-
this.constructor = AjvValidationError;
|
|
9
|
-
this.__proto__ = AjvValidationError.prototype;
|
|
10
|
-
Object.defineProperty(this, 'name', {
|
|
11
|
-
value: this.constructor.name,
|
|
12
|
-
configurable: true,
|
|
13
|
-
});
|
|
14
|
-
if (Error.captureStackTrace) {
|
|
15
|
-
Error.captureStackTrace(this, this.constructor);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
Object.defineProperty(this, 'stack', {
|
|
19
|
-
value: new Error().stack, // eslint-disable-line unicorn/error-message
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
8
|
}
|
|
23
9
|
}
|
|
24
10
|
exports.AjvValidationError = AjvValidationError;
|
|
@@ -5,20 +5,6 @@ const js_lib_1 = require("@naturalcycles/js-lib");
|
|
|
5
5
|
class JoiValidationError extends js_lib_1.AppError {
|
|
6
6
|
constructor(message, data) {
|
|
7
7
|
super(message, data);
|
|
8
|
-
this.constructor = JoiValidationError;
|
|
9
|
-
this.__proto__ = JoiValidationError.prototype;
|
|
10
|
-
Object.defineProperty(this, 'name', {
|
|
11
|
-
value: this.constructor.name,
|
|
12
|
-
configurable: true,
|
|
13
|
-
});
|
|
14
|
-
if (Error.captureStackTrace) {
|
|
15
|
-
Error.captureStackTrace(this, this.constructor);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
Object.defineProperty(this, 'stack', {
|
|
19
|
-
value: new Error().stack, // eslint-disable-line unicorn/error-message
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
8
|
}
|
|
23
9
|
}
|
|
24
10
|
exports.JoiValidationError = JoiValidationError;
|
|
@@ -130,6 +130,7 @@ function createError(value, err, objectName) {
|
|
|
130
130
|
// Make annotation non-enumerable, to not get it automatically printed,
|
|
131
131
|
// but still accessible
|
|
132
132
|
Object.defineProperty(data, 'annotation', {
|
|
133
|
+
writable: true,
|
|
133
134
|
configurable: true,
|
|
134
135
|
enumerable: false,
|
|
135
136
|
value: annotation,
|
package/package.json
CHANGED
|
@@ -10,20 +10,5 @@ export interface AjvValidationErrorData extends ErrorData {
|
|
|
10
10
|
export class AjvValidationError extends AppError<AjvValidationErrorData> {
|
|
11
11
|
constructor(message: string, data: AjvValidationErrorData) {
|
|
12
12
|
super(message, data)
|
|
13
|
-
|
|
14
|
-
this.constructor = AjvValidationError
|
|
15
|
-
;(this as any).__proto__ = AjvValidationError.prototype
|
|
16
|
-
Object.defineProperty(this, 'name', {
|
|
17
|
-
value: this.constructor.name,
|
|
18
|
-
configurable: true,
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
if (Error.captureStackTrace) {
|
|
22
|
-
Error.captureStackTrace(this, this.constructor)
|
|
23
|
-
} else {
|
|
24
|
-
Object.defineProperty(this, 'stack', {
|
|
25
|
-
value: new Error().stack, // eslint-disable-line unicorn/error-message
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
13
|
}
|
|
29
14
|
}
|
|
@@ -28,20 +28,5 @@ export interface JoiValidationErrorData extends ErrorData {
|
|
|
28
28
|
export class JoiValidationError extends AppError<JoiValidationErrorData> {
|
|
29
29
|
constructor(message: string, data: JoiValidationErrorData) {
|
|
30
30
|
super(message, data)
|
|
31
|
-
|
|
32
|
-
this.constructor = JoiValidationError
|
|
33
|
-
;(this as any).__proto__ = JoiValidationError.prototype
|
|
34
|
-
Object.defineProperty(this, 'name', {
|
|
35
|
-
value: this.constructor.name,
|
|
36
|
-
configurable: true,
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
if (Error.captureStackTrace) {
|
|
40
|
-
Error.captureStackTrace(this, this.constructor)
|
|
41
|
-
} else {
|
|
42
|
-
Object.defineProperty(this, 'stack', {
|
|
43
|
-
value: new Error().stack, // eslint-disable-line unicorn/error-message
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
31
|
}
|
|
47
32
|
}
|
|
@@ -172,6 +172,7 @@ function createError(value: any, err: ValidationError, objectName?: string): Joi
|
|
|
172
172
|
// Make annotation non-enumerable, to not get it automatically printed,
|
|
173
173
|
// but still accessible
|
|
174
174
|
Object.defineProperty(data, 'annotation', {
|
|
175
|
+
writable: true,
|
|
175
176
|
configurable: true,
|
|
176
177
|
enumerable: false,
|
|
177
178
|
value: annotation,
|