fix: ensure error messages are properly typed in API handlers

This commit is contained in:
sai80082 committed 2025-12-29 21:39:21 +05:30
1 parent ac8267b431
commit 0821e164ef
5 files changed
+3 -4

No files matched your search

BIN
View File
Binary file not shown.
-1
View File
@@ -52,7 +52,6 @@
"date-fns": "^3.6.0",
"drizzle-orm": "^0.33.0",
"jsonwebtoken": "^9.0.2",
"jszip": "^3.10.1",
"leaflet": "^1.9.4",
"leaflet-defaulticon-compatibility": "0.1.2",
"leaflet.heat": "^0.2.0",
+1 -1
View File
@@ -52,7 +52,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const params = validateParams(req);
if ("error" in params) {
return respondWithError(res, 400, params.error);
return respondWithError(res, 400, params.error as string);
}
const search = new URLSearchParams({ key: params.key, size: params.size });
+1 -1
View File
@@ -70,7 +70,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const validation = validatePayload(payload);
if ("error" in validation) {
return respondWithError(res, 400, validation.error);
return respondWithError(res, 400, validation.error ?? "Validation failed");
}
const params = validation;
+1 -1
View File
@@ -47,7 +47,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const params = validateParams(req);
if ("error" in params) {
return respondWithError(res, 400, params.error);
return respondWithError(res, 400, params.error as string);
}
const search = new URLSearchParams({ key: params.key });