fix(ts build error): fixed ts build error due to conflicting types

This commit is contained in:
Ritesh Ghosh
2025-01-01 13:42:07 +05:30
parent e0badf7449
commit cb5a4672a8
+5 -4
View File
@@ -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);
};