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
+3 -3
View File
@@ -1,5 +1,5 @@
// @ts-check
const { InvalidRequestError, InvalidParamsError } = require('./Errors')
const { ParamsError } = require('./Errors')
/**
* @typedef {import('zod').ZodType} ZodType
@@ -25,9 +25,9 @@ function parseReq(req, schema) {
return parsed.data
} else if (parsed.error.issues.some(issue => issue.path[0] === 'params')) {
// Parts of the URL path failed to validate; throw a specific error
throw new InvalidParamsError(parsed.error)
throw new ParamsError('Invalid params').withCause(parsed.error)
} else {
throw new InvalidRequestError(parsed.error)
throw parsed.error
}
}