resolve-runtime
Version:
This package create server with resolve.
30 lines (24 loc) • 893 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.httpMaximumCode = exports.httpMinimumCode = exports.httpCodeInternalServerError = void 0;
const httpCodeInternalServerError = 500;
exports.httpCodeInternalServerError = httpCodeInternalServerError;
const httpMinimumCode = 100;
exports.httpMinimumCode = httpMinimumCode;
const httpMaximumCode = 599;
exports.httpMaximumCode = httpMaximumCode;
const extractErrorHttpCode = error => {
if (!error instanceof Error || !error.hasOwnProperty('code')) {
return httpCodeInternalServerError;
}
const code = error.code;
if (!Number.isInteger(code) || code < httpMinimumCode || code > httpMaximumCode) {
return httpCodeInternalServerError;
}
return code;
};
var _default = extractErrorHttpCode;
exports.default = _default;
//# sourceMappingURL=extract_error_http_code.js.map
;