From 442c60b8f92499c45076c3c4cc1a1472b2dd8098 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 30 Nov 2025 06:39:51 +0900 Subject: feat(server): add error handling middleware MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkgs/server/src/index.ts | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pkgs/server/src/index.ts') 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" }); }); -- cgit v1.2.3-70-g09d2