diff --git a/src/middlewares/schemaValidator.middleware.ts b/src/middlewares/schemaValidator.middleware.ts index c6b8657..8533acf 100644 --- a/src/middlewares/schemaValidator.middleware.ts +++ b/src/middlewares/schemaValidator.middleware.ts @@ -203,14 +203,17 @@ export const schemaErrorHandler = ( if (err instanceof Exception) { next(err); } else { - const errorData = new Exception( - ExceptionType.OpenApiSchema_ParsingError, - `OpenApiValidator Error at ${protocolServerLevel}`, - err.status, - err - ); - - next(errorData); + console.log('OpenApiValidator Error', err); + req.body = { + ...req.body, + message: {}, + error: { + code: err.status + '', + path: err.path, + message: err.message + } + } + next(); } };