aboutsummaryrefslogtreecommitdiffhomepage
path: root/pkgs/server/src/index.ts
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-11-30 06:39:51 +0900
committernsfisis <nsfisis@gmail.com>2025-12-04 23:26:11 +0900
commit442c60b8f92499c45076c3c4cc1a1472b2dd8098 (patch)
tree67da31227d316a7d7ce5de1abd7c29b865279849 /pkgs/server/src/index.ts
parent64a1b249d25fe52df9ad7d8c034e2e004354ecd5 (diff)
downloadkioku-442c60b8f92499c45076c3c4cc1a1472b2dd8098.tar.gz
kioku-442c60b8f92499c45076c3c4cc1a1472b2dd8098.tar.zst
kioku-442c60b8f92499c45076c3c4cc1a1472b2dd8098.zip
feat(server): add error handling middleware
Add global error handling middleware for Hono with: - AppError class for application-specific errors with status codes - Errors factory for common HTTP errors (badRequest, unauthorized, etc.) - Consistent JSON error response format - Tests covering all error types 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'pkgs/server/src/index.ts')
-rw-r--r--pkgs/server/src/index.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkgs/server/src/index.ts b/pkgs/server/src/index.ts
index 6c89217..54c1059 100644
--- a/pkgs/server/src/index.ts
+++ b/pkgs/server/src/index.ts
@@ -1,8 +1,11 @@
import { serve } from "@hono/node-server";
import { Hono } from "hono";
+import { errorHandler } from "./middleware/error-handler";
const app = new Hono();
+app.onError(errorHandler);
+
app.get("/", (c) => {
return c.json({ message: "Kioku API" });
});