Skip to content

Commit

Permalink
Merge branch 'develop' into DVK-102-refactoring-ebook-inquiry
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeSM0518 authored Nov 23, 2024
2 parents eb733db + 3e45bf9 commit 56bc7a0
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.springframework.web.reactive.function.server.ServerResponse
import org.springframework.web.reactive.resource.NoResourceFoundException
import org.springframework.web.server.MissingRequestValueException
import org.springframework.web.server.ServerWebInputException
import org.springframework.web.server.UnsupportedMediaTypeStatusException
import reactor.core.publisher.Mono

@Component
Expand Down Expand Up @@ -94,7 +95,16 @@ class GlobalErrorWebExceptionHandler(
.body(BodyInserters.fromValue(errorAttributes))
}

is UnsupportedMediaTypeStatusException -> {
errorAttributes["reason"] = error.reason
ServerResponse
.status(error.statusCode)
.contentType(MediaType.APPLICATION_JSON)
.body(BodyInserters.fromValue(errorAttributes))
}

else -> {
errorAttributes["reason"] = error.cause.toString()
ServerResponse
.status(HttpStatus.INTERNAL_SERVER_ERROR)
.contentType(MediaType.APPLICATION_JSON)
Expand Down

0 comments on commit 56bc7a0

Please sign in to comment.