Skip to content

Commit

Permalink
feat: RestControllerAdvice에 Sentry.captureException 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
belljun3395 committed Dec 18, 2024
1 parent 2f46f48 commit 7a4dc9d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web/src/main/kotlin/web/handler/ControllerExceptionHandler.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package web.handler

import io.sentry.Sentry
import jakarta.servlet.http.HttpServletRequest
import jakarta.validation.ConstraintViolationException
import org.springframework.beans.TypeMismatchException
Expand Down Expand Up @@ -28,6 +29,7 @@ class ControllerExceptionHandler(
request: HttpServletRequest,
): ApiResponse<ApiResponse.FailureBody> {
loggingHandler.writeLog(ex, request)
Sentry.captureException(ex)
return ApiResponseGenerator.fail(ExceptionMessage.FAIL.message, HttpStatus.BAD_REQUEST)
}

Expand All @@ -47,6 +49,7 @@ class ControllerExceptionHandler(
request: HttpServletRequest,
): ApiResponse<ApiResponse.FailureBody> {
loggingHandler.writeLog(ex, request)
Sentry.captureException(ex)
return handleRequestDetails(ex)
}

Expand Down Expand Up @@ -83,6 +86,7 @@ class ControllerExceptionHandler(
request: HttpServletRequest,
): ApiResponse<ApiResponse.FailureBody> {
loggingHandler.writeLog(ex, request)
Sentry.captureException(ex)
return ApiResponseGenerator.fail(
ExceptionMessage.FAIL.message,
HttpStatus.INTERNAL_SERVER_ERROR,
Expand All @@ -95,6 +99,7 @@ class ControllerExceptionHandler(
request: HttpServletRequest,
): ApiResponse<ApiResponse.FailureBody> {
loggingHandler.writeLog(ex, request)
Sentry.captureException(ex)
return ApiResponseGenerator.fail(
ExceptionMessage.ACCESS_DENIED.message,
HttpStatus.FORBIDDEN,
Expand All @@ -107,6 +112,7 @@ class ControllerExceptionHandler(
request: HttpServletRequest,
): ApiResponse<ApiResponse.FailureBody> {
loggingHandler.writeLog(ex, request)
Sentry.captureException(ex)
return ApiResponseGenerator.fail(
ExceptionMessage.FAIL.message,
HttpStatus.INTERNAL_SERVER_ERROR,
Expand Down

0 comments on commit 7a4dc9d

Please sign in to comment.