with-simple-caching
Version:
A wrapper that makes it simple to add caching to any function
17 lines • 745 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BadRequestError = void 0;
/**
* BadRequestError errors are used to indicate that we've reached a code path that is invalid due to user input
*
* Purpose of having a dedicated class for this type of error is to allow us to easily add metadata about what was going on when we reached this code path
* - e.g., the variables in memory at the time
*/
class BadRequestError extends Error {
constructor(message, metadata) {
const fullMessage = `BadRequestError: ${message}${metadata ? `\n\n${JSON.stringify(metadata)}` : ''}}`;
super(fullMessage);
}
}
exports.BadRequestError = BadRequestError;
//# sourceMappingURL=BadRequestError.js.map