temp(Exception): ResponseStatusException은 ApiResponse로 래핑하지 않고 그대로 전달
This commit is contained in:
@@ -3,6 +3,7 @@ package kr.co.vividnext.sodalive.common
|
|||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.springframework.dao.DataIntegrityViolationException
|
import org.springframework.dao.DataIntegrityViolationException
|
||||||
import org.springframework.http.HttpStatus
|
import org.springframework.http.HttpStatus
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
import org.springframework.security.access.AccessDeniedException
|
import org.springframework.security.access.AccessDeniedException
|
||||||
import org.springframework.security.authentication.BadCredentialsException
|
import org.springframework.security.authentication.BadCredentialsException
|
||||||
import org.springframework.security.authentication.InternalAuthenticationServiceException
|
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.ResponseStatus
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice
|
import org.springframework.web.bind.annotation.RestControllerAdvice
|
||||||
import org.springframework.web.multipart.MaxUploadSizeExceededException
|
import org.springframework.web.multipart.MaxUploadSizeExceededException
|
||||||
|
import org.springframework.web.server.ResponseStatusException
|
||||||
|
|
||||||
@RestControllerAdvice
|
@RestControllerAdvice
|
||||||
class SodaExceptionHandler {
|
class SodaExceptionHandler {
|
||||||
@@ -24,6 +26,13 @@ class SodaExceptionHandler {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ResponseStatusException은 ApiResponse로 래핑하지 않고 그대로 전달
|
||||||
|
@ExceptionHandler(ResponseStatusException::class)
|
||||||
|
fun handleResponseStatusException(e: ResponseStatusException): ResponseEntity<Void> {
|
||||||
|
// 별도 바디 없이 상태코드만 반환하여 기본 예외 형태를 유지
|
||||||
|
return ResponseEntity.status(e.status).build()
|
||||||
|
}
|
||||||
|
|
||||||
@ExceptionHandler(MaxUploadSizeExceededException::class)
|
@ExceptionHandler(MaxUploadSizeExceededException::class)
|
||||||
fun handleMaxUploadSizeExceededException(e: MaxUploadSizeExceededException) = run {
|
fun handleMaxUploadSizeExceededException(e: MaxUploadSizeExceededException) = run {
|
||||||
logger.error("API error", e)
|
logger.error("API error", e)
|
||||||
|
Reference in New Issue
Block a user