serverless-offline-edge-lambda
Version:
A plugin for the Serverless Framework that simulates the behavior of AWS CloudFront Edge Lambdas while developing offline.
26 lines • 785 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpError = void 0;
const http_status_codes_1 = require("http-status-codes");
class HttpError extends Error {
constructor(message, statusCode, originalError = null) {
super(message);
this.message = message;
this.statusCode = statusCode;
try {
this.reasonPhrase = (0, http_status_codes_1.getReasonPhrase)(statusCode);
}
catch (_a) {
this.reasonPhrase = 'Unknown';
}
this.originalError = originalError;
}
getResponsePayload() {
return {
code: this.statusCode,
message: this.message
};
}
}
exports.HttpError = HttpError;
//# sourceMappingURL=http.error.js.map