debug(zod): log unsupported protocol errors
This commit is contained in:
@@ -192,6 +192,10 @@ if (cluster.isMaster) {
|
|||||||
|
|
||||||
app.use((err: unknown, req: Request<{}, ErrorResponse, undefined>, res: Response<ErrorResponse>, next: NextFunction) => {
|
app.use((err: unknown, req: Request<{}, ErrorResponse, undefined>, res: Response<ErrorResponse>, next: NextFunction) => {
|
||||||
if (err instanceof ZodError) {
|
if (err instanceof ZodError) {
|
||||||
|
if (Array.isArray(err.errors) && err.errors.find(x => x.message === "URL uses unsupported protocol")) {
|
||||||
|
Logger.warn("Unsupported protocol error: " + JSON.stringify(req.body));
|
||||||
|
}
|
||||||
|
|
||||||
res.status(400).json({ success: false, error: "Bad Request", details: err.errors });
|
res.status(400).json({ success: false, error: "Bad Request", details: err.errors });
|
||||||
} else {
|
} else {
|
||||||
next(err);
|
next(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user