diff --git a/packages/schema/src/hooks/validate.ts b/packages/schema/src/hooks/validate.ts index dc31de5fbe..2ca30e7900 100644 --- a/packages/schema/src/hooks/validate.ts +++ b/packages/schema/src/hooks/validate.ts @@ -19,13 +19,13 @@ export const validateQuery = (schema: Schema | Valid ...context.params, query } - - if (typeof next === 'function') { - return next() - } } catch (error: any) { throw error.ajv ? new BadRequest(error.message, error.errors) : error } + + if (typeof next === 'function') { + return next() + } } }