Merge pull request #33413 from overleaf/revert-33040-em-parse-req-errors

Revert "Replace isZodErrorLike with custom error types in request validation"

GitOrigin-RevId: 1f51fe9e14ffabf283f1229552d3887136420f8f
This commit is contained in:
Eric Mc Sween
2026-05-06 08:06:41 +00:00
committed by Copybot
parent 98def949ec
commit 3da2d53acb
16 changed files with 80 additions and 100 deletions
+4 -6
View File
@@ -13,10 +13,8 @@ import methodOverride from 'method-override'
import { mongoClient } from './app/js/mongodb.js'
import NotificationsController from './app/js/NotificationsController.ts'
import HealthCheckController from './app/js/HealthCheckController.ts'
import {
InvalidParamsError,
InvalidRequestError,
} from '@overleaf/validation-tools'
import { isZodErrorLike } from 'zod-validation-error'
import { ParamsError } from '@overleaf/validation-tools'
const app = express()
@@ -58,10 +56,10 @@ const handleApiError: ErrorRequestHandler = (
next: NextFunction
) => {
req.logger.addFields({ err })
if (err instanceof InvalidParamsError) {
if (err instanceof ParamsError) {
req.logger.setLevel('warn')
res.sendStatus(404)
} else if (err instanceof InvalidRequestError) {
} else if (isZodErrorLike(err)) {
req.logger.setLevel('warn')
res.sendStatus(400)
} else {