fix(ts build error): fixed ts build error due to conflicting types
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
import { HiAnimeError } from "aniwatch";
|
import { HiAnimeError } from "aniwatch";
|
||||||
import type { ErrorHandler, NotFoundHandler } from "hono";
|
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,
|
status: 500,
|
||||||
message: "Internal Server Error",
|
message: "Internal Server Error",
|
||||||
};
|
};
|
||||||
@@ -10,11 +11,11 @@ export const errorHandler: ErrorHandler = (err, c) => {
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
||||||
if (err instanceof HiAnimeError) {
|
if (err instanceof HiAnimeError) {
|
||||||
errResp.status = err.status;
|
errResp.status = err.status as ContentfulStatusCode;
|
||||||
errResp.message = err.message;
|
errResp.message = err.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.json(errResp, { status: errResp.status });
|
return c.json(errResp, errResp.status);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const notFoundHandler: NotFoundHandler = (c) => {
|
export const notFoundHandler: NotFoundHandler = (c) => {
|
||||||
@@ -22,5 +23,5 @@ export const notFoundHandler: NotFoundHandler = (c) => {
|
|||||||
errResp.message = "Not Found";
|
errResp.message = "Not Found";
|
||||||
|
|
||||||
console.error(errResp);
|
console.error(errResp);
|
||||||
return c.json(errResp, { status: errResp.status });
|
return c.json(errResp, errResp.status);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user