one-link/node_modules/hono/dist/http-exception.js

22 lines
414 B
JavaScript

// src/http-exception.ts
var HTTPException = class extends Error {
res;
status;
constructor(status = 500, options) {
super(options?.message, { cause: options?.cause });
this.res = options?.res;
this.status = status;
}
getResponse() {
if (this.res) {
return this.res;
}
return new Response(this.message, {
status: this.status
});
}
};
export {
HTTPException
};