@busy-hour/blaze
Version:
<h1 align='center'>🔥 Blaze</h1> <div align='center'> An event driven framework for 🔥 Hono.js </div>
28 lines (27 loc) • 578 B
JavaScript
// src/internal/errors/index.ts
var BlazeError = class extends Error {
status;
errors;
constructor(err, status = 500) {
super(typeof err === "string" ? err : err.message);
if (typeof err === "string") {
this.status = status;
this.name = "BlazeError";
} else {
this.status = err.status;
this.errors = err.errors;
this.name = err.name ?? "BlazeError";
}
}
toJSON() {
return {
errors: this.errors,
message: this.message,
name: this.name,
status: this.status
};
}
};
export {
BlazeError
};