File size: 350 Bytes
7f6dd09 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | export default async function errorHandler(c, next) {
try {
await next();
} catch (err) {
const ts = new Date().toISOString();
const path = c.req.path;
console.error(`[${ts}] Unhandled error at ${path}:`, err);
return c.json(
{ error: err.message || "Internal server error", status: 500, path },
500,
);
}
}
|