Skip to content

Commit 8cbc935

Browse files
committed
fix: add error logging to exception handler for debugging
1 parent 4065d6d commit 8cbc935

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

โ€Žsrc/main/java/org/runnect/server/common/advice/ControllerExceptionAdvice.javaโ€Ž

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected ApiResponseDto handleConstraintViolationException(final ConstraintViol
5252
return ApiResponseDto.error(ErrorStatus.VALIDATION_REQUEST_HEADER_MISSING_EXCEPTION, String.format("%s. (%s)", ErrorStatus.VALIDATION_REQUEST_HEADER_MISSING_EXCEPTION.getMessage(), e.getConstraintViolations()));
5353
}
5454

55-
@ResponseStatus(HttpStatus.BAD_REQUEST)
55+
@ResponseStatus(HttpStatus.BAD_REEUEST)
5656
@ExceptionHandler(IllegalArgumentException.class)
5757
protected ApiResponseDto handleConstraintViolationException(final IllegalArgumentException e) {
5858
return ApiResponseDto.error(ErrorStatus.VALIDATION_REQUEST_HEADER_MISSING_EXCEPTION, String.format("%s. (%s)", ErrorStatus.INVALID_PARAMETER_EXCEPTION.getMessage(), e.getMessage()));
@@ -61,7 +61,7 @@ protected ApiResponseDto handleConstraintViolationException(final IllegalArgumen
6161
@ResponseStatus(HttpStatus.BAD_REQUEST)
6262
@ExceptionHandler(MissingServletRequestParameterException.class)
6363
protected ApiResponseDto handleMissingRequestParameterException(final MissingServletRequestParameterException e) {
64-
return ApiResponseDto.error(ErrorStatus.VALIDATION_REQUEST_PARAMETER_MISSING_EXCEPTION, String.format("%s. (%s)", ErrorStatus.VALIDATION_REQUEST_PARAMETER_MISSING_EXCEPTION.getMessage(), e.getParameterName()));
64+
returnApiResponseDto.error(ErrorStatus.VALIDATION_REQUEST_PARAMETER_MISSING_EXCEPTION, String.format("%s. (%s)", ErrorStatus.VALIDATION_REQUEST_PARAMETER_MISSING_EXCEPTION.getMessage(), e.getParameterName()));
6565
}
6666

6767

@@ -73,15 +73,16 @@ protected ApiResponseDto handleMissingRequestParameterException(final MissingSer
7373
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
7474
@ExceptionHandler(Exception.class)
7575
protected ApiResponseDto<Object> handleException(final Exception error, final HttpServletRequest request) {
76+
log.error("[500 ERROR] {} {}", request.getMethod(), request.getRequestURI(), error);
7677
try {
7778
slackApi.sendAlert(error, request);
7879
} catch (Exception e) {
79-
log.error("Slack ์•Œ๋ฆผ ์ „์†ก ์‹คํŒจ", e);
80+
log.error("Slack ์•Œ๋ฆผ ์ „์†  ์‹คํŒจ", e);
8081
}
8182
try {
8283
Sentry.captureException(error);
8384
} catch (Exception e) {
84-
log.error("Sentry ์ „์†ก ์‹คํŒจ", e);
85+
log.error("Sentry ์ „์†  ์‹คํŒจ", e);
8586
}
8687
return ApiResponseDto.error(ErrorStatus.INTERNAL_SERVER_ERROR);
8788
}

0 commit comments

Comments
ย (0)