From 3c32614d1c5e28f46ddc480d7268e9f1ebc50b9c Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 30 Sep 2025 17:59:55 +0900 Subject: [PATCH] =?UTF-8?q?temp(Exception):=20ResponseStatusException?= =?UTF-8?q?=EC=9D=80=20ApiResponse=EB=A1=9C=20=EB=9E=98=ED=95=91=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EA=B3=A0=20=EA=B7=B8=EB=8C=80=EB=A1=9C=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../co/vividnext/sodalive/common/SodaExceptionHandler.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/common/SodaExceptionHandler.kt b/src/main/kotlin/kr/co/vividnext/sodalive/common/SodaExceptionHandler.kt index 045cf83..8bc17d7 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/common/SodaExceptionHandler.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/common/SodaExceptionHandler.kt @@ -3,6 +3,7 @@ package kr.co.vividnext.sodalive.common import org.slf4j.LoggerFactory import org.springframework.dao.DataIntegrityViolationException import org.springframework.http.HttpStatus +import org.springframework.http.ResponseEntity import org.springframework.security.access.AccessDeniedException import org.springframework.security.authentication.BadCredentialsException import org.springframework.security.authentication.InternalAuthenticationServiceException @@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler import org.springframework.web.bind.annotation.ResponseStatus import org.springframework.web.bind.annotation.RestControllerAdvice import org.springframework.web.multipart.MaxUploadSizeExceededException +import org.springframework.web.server.ResponseStatusException @RestControllerAdvice class SodaExceptionHandler { @@ -24,6 +26,13 @@ class SodaExceptionHandler { ) } + // ResponseStatusException은 ApiResponse로 래핑하지 않고 그대로 전달 + @ExceptionHandler(ResponseStatusException::class) + fun handleResponseStatusException(e: ResponseStatusException): ResponseEntity { + // 별도 바디 없이 상태코드만 반환하여 기본 예외 형태를 유지 + return ResponseEntity.status(e.status).build() + } + @ExceptionHandler(MaxUploadSizeExceededException::class) fun handleMaxUploadSizeExceededException(e: MaxUploadSizeExceededException) = run { logger.error("API error", e)