Skip to content

Commit

Permalink
Handling error message to be sent when BPP response fails validation …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
Abhishek Y committed Jul 17, 2024
1 parent 6ec22eb commit 96fba58
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/middlewares/schemaValidator.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};

Expand Down

0 comments on commit 96fba58

Please sign in to comment.