From cb5a4672a8c3b0729bbb4522a3af252f7b336b97 Mon Sep 17 00:00:00 2001 From: Ritesh Ghosh Date: Wed, 1 Jan 2025 13:42:07 +0530 Subject: fix(ts build error): fixed ts build error due to conflicting types --- src/config/errorHandler.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/config/errorHandler.ts b/src/config/errorHandler.ts index 4333687..d6f3193 100644 --- a/src/config/errorHandler.ts +++ b/src/config/errorHandler.ts @@ -1,7 +1,8 @@ import { HiAnimeError } from "aniwatch"; import type { ErrorHandler, NotFoundHandler } from "hono"; +import type { ContentfulStatusCode } from "hono/utils/http-status"; -const errResp: { status: number; message: string } = { +const errResp: { status: ContentfulStatusCode; message: string } = { status: 500, message: "Internal Server Error", }; @@ -10,11 +11,11 @@ export const errorHandler: ErrorHandler = (err, c) => { console.error(err); if (err instanceof HiAnimeError) { - errResp.status = err.status; + errResp.status = err.status as ContentfulStatusCode; errResp.message = err.message; } - return c.json(errResp, { status: errResp.status }); + return c.json(errResp, errResp.status); }; export const notFoundHandler: NotFoundHandler = (c) => { @@ -22,5 +23,5 @@ export const notFoundHandler: NotFoundHandler = (c) => { errResp.message = "Not Found"; console.error(errResp); - return c.json(errResp, { status: errResp.status }); + return c.json(errResp, errResp.status); }; -- cgit v1.2.3