Skip to content

Commit

Permalink
Merge pull request #231 from beckn/validation-error
Browse files Browse the repository at this point in the history
raising and sending exception back in case of bap client
  • Loading branch information
em-abee authored Oct 9, 2024
2 parents 29c702b + 7f1d5e5 commit 5b3ea18
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/middlewares/schemaValidator.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,19 @@ export const schemaErrorHandler = (
next: NextFunction
) => {
logger.error('OpenApiValidator Error', err);
if (
getConfig().app.mode === AppMode.bap &&
getConfig().app.gateway.mode === GatewayMode.client
){
const errorData = new Exception(
ExceptionType.OpenApiSchema_ParsingError,
`OpenApiValidator Error`,
500,
err
);
next(errorData);
return
}
if (err instanceof Exception) {
next(err);
} else {
Expand Down

0 comments on commit 5b3ea18

Please sign in to comment.