diff options
| author | Ritesh Ghosh <[email protected]> | 2025-01-01 13:42:07 +0530 |
|---|---|---|
| committer | Ritesh Ghosh <[email protected]> | 2025-01-01 13:42:07 +0530 |
| commit | cb5a4672a8c3b0729bbb4522a3af252f7b336b97 (patch) | |
| tree | 6d65f215aa4d52351e9bd8e39b1ad4573272237b | |
| parent | e0badf7449abf28751294a997de2b89f2434aac0 (diff) | |
| download | aniwatch-api-cb5a4672a8c3b0729bbb4522a3af252f7b336b97.tar.xz aniwatch-api-cb5a4672a8c3b0729bbb4522a3af252f7b336b97.zip | |
fix(ts build error): fixed ts build error due to conflicting types
| -rw-r--r-- | src/config/errorHandler.ts | 9 |
1 files 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); }; |
