mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 14:39:39 +02:00
Assorted changes from recent sessions: - .gitignore: add mana-sync binary, Forgejo data - chat/web: add isSidebarMode to navigation store - clock/web: fix alarm page markup - contacts/mukke/presi/questions: add svelte.config.js aliases - context/web: add missing dependency - manacore/landing: update pricing page - manacore/web + todo/web: update mana dashboard pages - planta/web: fix dashboard layout - pnpm-lock.yaml: cleanup after backend removals - docs/APP_GAP_ANALYSIS.md: new gap analysis doc - services/mana-analytics: add Dockerfile - services/mana-subscriptions: new Go subscription service Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
592 B
TypeScript
29 lines
592 B
TypeScript
/**
|
|
* Global error handler middleware for Hono.
|
|
*/
|
|
|
|
import type { ErrorHandler } from 'hono';
|
|
import { HTTPException } from 'hono/http-exception';
|
|
|
|
export const errorHandler: ErrorHandler = (err, c) => {
|
|
if (err instanceof HTTPException) {
|
|
const cause = err.cause as Record<string, unknown> | undefined;
|
|
return c.json(
|
|
{
|
|
statusCode: err.status,
|
|
message: err.message,
|
|
...(cause ? { details: cause } : {}),
|
|
},
|
|
err.status
|
|
);
|
|
}
|
|
|
|
console.error('Unhandled error:', err);
|
|
return c.json(
|
|
{
|
|
statusCode: 500,
|
|
message: 'Internal server error',
|
|
},
|
|
500
|
|
);
|
|
};
|