fix: ensure error messages are properly typed in API handlers
This commit is contained in:
1 parent
ac8267b431
commit
0821e164ef
5 files changed
+3
-4
No files matched your search
@@ -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",
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 });
|
||||
|
||||
Reference in new issue
Block a user