v0.22.0 — self-handling exceptions + error codes
Richer exception handling:
export class PaymentRequiredException extends HttpException {
code = "E_PAYMENT_REQUIRED";
constructor() { super(402, "Payment required"); }
handle(c) { return c.json({ error: this.message, upgrade: "/billing" }, this.status); }
report() { metrics.increment("payment_required"); }
}handle(c)→ the exception renders itself.report()→ awaited before rendering, for logging/metrics (never masks the error).code→ included in the JSON error body. See docs/errors.md.