From 657a62ad215aaf71128ae1dc177940f4f973eee1 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:07:34 +0900 Subject: [PATCH] [F] Fix error logging --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 79fae82..fbee222 100644 --- a/src/index.ts +++ b/src/index.ts @@ -127,8 +127,9 @@ export const app = new Elysia() // Error handling: Return status code and message .onError(({ error, status }) => { if (error instanceof HttpError) { - console.error(`[-] HTTP ${error.status}: ${error.message}`) - if (error.content instanceof String) return status(error.status, { msg: error.message }) + const errorMessage = typeof error.content === "string" ? error.content : JSON.stringify(error.content) + console.error(`[-] HTTP ${error.status}: ${errorMessage}`) + if (typeof error.content === "string") return status(error.status, { msg: error.content }) else return status(error.status, error.content) } else throw error