@nydelic/toolbox
Version:
A collection of hooks, components, and other helpful tools.
24 lines • 895 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
class HttpRequestError extends Error {
constructor(shortCode, statusCodeOrOptions = 500, message, options) {
const constructorOptions = statusCodeOrOptions && typeof statusCodeOrOptions === "object"
? statusCodeOrOptions
: options;
super(message, constructorOptions);
this.statusCode = 500;
this.message = "An unknown error has occured";
// init class properties
this.name = this.constructor.name;
this.shortCode = shortCode;
this.eventId = Date.now();
if (typeof statusCodeOrOptions === "number") {
this.statusCode = statusCodeOrOptions;
}
if (message) {
this.message = message;
}
}
}
exports.default = HttpRequestError;
//# sourceMappingURL=HttpRequestError.js.map