Skip to content

Commit

Permalink
fix(ts build error): fixed ts build error due to conflicting types
Browse files Browse the repository at this point in the history
  • Loading branch information
ghoshRitesh12 committed Jan 1, 2025
1 parent e0badf7 commit cb5a467
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/config/errorHandler.ts
Original file line number Diff line number Diff line change
@@ -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",
};
Expand All @@ -10,17 +11,17 @@ 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) => {
errResp.status = 404;
errResp.message = "Not Found";

console.error(errResp);
return c.json(errResp, { status: errResp.status });
return c.json(errResp, errResp.status);
};

0 comments on commit cb5a467

Please sign in to comment.