UNPKG

@nahkies/typescript-express-runtime

Version:

Runtime package for code generated by @nahkies/openapi-code-generator using the typescript-express template

49 lines (48 loc) 1.53 kB
//#region ../typescript-common-runtime/dist/esm/errors.mjs let RequestInputType = /* @__PURE__ */ function(RequestInputType) { RequestInputType["RouteParam"] = "route params"; RequestInputType["QueryString"] = "querystring"; RequestInputType["RequestBody"] = "request body"; RequestInputType["RequestHeader"] = "request header"; return RequestInputType; }({}); var AbstractRuntimeError = class extends Error { phase; constructor(message, cause, phase) { super(message, { cause }); this.phase = phase; } }; //#endregion //#region src/errors.ts var ExpressRuntimeError = class ExpressRuntimeError extends AbstractRuntimeError { constructor(message, cause, phase) { super(message, cause, phase); } static RequestError(cause, inputType) { return new ExpressRuntimeError(`Request validation failed parsing ${inputType}`, cause, "request_validation"); } static HandlerError(cause) { return new ExpressRuntimeError("Request handler threw unhandled exception", cause, "request_handler"); } static ResponseError(cause) { return new ExpressRuntimeError("Response body failed validation", cause, "response_validation"); } static isExpressError(err) { return err instanceof ExpressRuntimeError; } }; //#endregion Object.defineProperty(exports, "ExpressRuntimeError", { enumerable: true, get: function() { return ExpressRuntimeError; } }); Object.defineProperty(exports, "RequestInputType", { enumerable: true, get: function() { return RequestInputType; } }); //# sourceMappingURL=errors-tNsCEbdN.cjs.map