Skip to content

Commit

Permalink
feat: ErrorResponseException handling
Browse files Browse the repository at this point in the history
  • Loading branch information
suw0n committed May 29, 2024
1 parent 8c9927c commit ace8c50
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import org.springframework.context.ApplicationContext
import org.springframework.core.annotation.Order
import org.springframework.http.codec.ServerCodecConfigurer
import org.springframework.stereotype.Component
import org.springframework.web.ErrorResponseException
import org.springframework.web.reactive.function.server.*
import org.springframework.web.server.ServerWebInputException
import reactor.core.publisher.Mono

@Component
Expand Down Expand Up @@ -42,7 +42,7 @@ class ExceptionExchangeHandler(
private fun handleError(request: ServerRequest): Mono<ServerResponse> =
when(val e = super.getError(request)) {
is BaseException -> buildErrorResponse(e)
is ServerWebInputException -> buildErrorResponse(BaseException(400, "잘못된 파라미터입니다"))
is ErrorResponseException -> buildErrorResponse(BaseException(e.statusCode.value(), e.message))
else -> buildErrorResponse(InternalServerException)
}

Expand Down

0 comments on commit ace8c50

Please sign in to comment.