fix: add comprehensive error handling and logging to api and web

Wrap all async API route handlers and services in try/catch blocks,
piping errors to the @nhcarrigan/logger telemetry service. Add a
frontend logError utility, React ErrorBoundary, and overridden console
to forward all unhandled client-side errors to the backend telemetry
endpoint.
This commit is contained in:
2026-03-09 18:57:56 -07:00
committed by Naomi Carrigan
parent 11e97325cb
commit 66413c5e21
30 changed files with 2297 additions and 1724 deletions
+8 -1
View File
@@ -6,6 +6,7 @@
*/
import { verifyToken } from "../services/jwt.js";
import { logger } from "../services/logger.js";
import type { HonoEnvironment } from "../types/hono.js";
import type { MiddlewareHandler } from "hono";
@@ -33,7 +34,13 @@ export const authMiddleware: MiddlewareHandler<HonoEnvironment> = async(
try {
const payload = verifyToken(token);
context.set("discordId", payload.discordId);
} catch {
} catch (error) {
void logger.error(
"auth_middleware",
error instanceof Error
? error
: new Error(String(error)),
);
return context.json({ error: "Invalid or expired token" }, 401);
}