@aws-lambda-powertools/parser
Version:
The parser package for the Powertools for AWS Lambda (TypeScript) library.
18 lines (17 loc) • 632 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParseError = void 0;
/**
* Custom parsing error that wraps any erros thrown during schema or envelope parsing.
* The cause of the error is included in the message, if possible.
*/
class ParseError extends Error {
constructor(message, options) {
const errorMessage = options?.cause && options.cause instanceof Error
? `${message}. This error was caused by: ${options?.cause.message}.`
: message;
super(errorMessage, options);
this.name = 'ParseError';
}
}
exports.ParseError = ParseError;