From e5fc645344fe45b602efcbb8351fb333c1029530 Mon Sep 17 00:00:00 2001 From: 3keyroman <46850604+3keyroman@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:32:25 +0200 Subject: [PATCH] Fix response for runtime exception (#96) --- .../ca/connector/ejbca/ExceptionHandlingAdvice.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/czertainly/ca/connector/ejbca/ExceptionHandlingAdvice.java b/src/main/java/com/czertainly/ca/connector/ejbca/ExceptionHandlingAdvice.java index 13c2ffe..417a4d2 100644 --- a/src/main/java/com/czertainly/ca/connector/ejbca/ExceptionHandlingAdvice.java +++ b/src/main/java/com/czertainly/ca/connector/ejbca/ExceptionHandlingAdvice.java @@ -146,9 +146,9 @@ public ErrorMessageDto handleMessageNotReadable(CertificateRequestException ex) * @return */ @ExceptionHandler(RuntimeException.class) - @ResponseStatus(HttpStatus.UNPROCESSABLE_ENTITY) + @ResponseStatus(HttpStatus.BAD_REQUEST) public ErrorMessageDto handleRuntimeException(RuntimeException ex) { - LOG.info("HTTP 422: {}", ex.getMessage()); + LOG.info("HTTP 400: {}", ex.getMessage()); return ErrorMessageDto.getInstance(ex.getMessage()); }