@nodeswork/utils
Advanced tools
Comparing version 0.1.11 to 0.1.12
@@ -71,3 +71,4 @@ export interface ErrorCaster { | ||
export declare const HTTP_RESPONSE_CASTER: ErrorCaster; | ||
export declare const JSON_CASTER: ErrorCaster; | ||
export declare class ValidationError extends NodesworkError { | ||
} |
@@ -182,2 +182,11 @@ "use strict"; | ||
}; | ||
exports.JSON_CASTER = { | ||
filter: (error, options) => { | ||
return error && error.name === 'NodesworkError' && | ||
!(error instanceof NodesworkError); | ||
}, | ||
cast: (error, options, cls) => { | ||
return new NodesworkError(error.message, error.meta, error.cause); | ||
}, | ||
}; | ||
class ValidationError extends NodesworkError { | ||
@@ -187,1 +196,2 @@ } | ||
NodesworkError.addErrorCaster(exports.PASSTHROUGH_CASTER); | ||
NodesworkError.addErrorCaster(exports.JSON_CASTER); |
{ | ||
"name": "@nodeswork/utils", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"description": "Utilities used across nodeswork repos.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56246
1073