Skip to content

Commit

Permalink
fix: eat AsyncRequestTimeoutException (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
toychip authored Sep 3, 2024
1 parent d18ea81 commit 61baf1a
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.ExceptionHandler
import org.springframework.web.bind.annotation.RestControllerAdvice
import org.springframework.web.context.request.async.AsyncRequestTimeoutException

private val log = KotlinLogging.logger {}

Expand All @@ -24,6 +25,12 @@ class ControllerExceptionAdvice {
return errorResponse(ex.httpStatusCode, ex.toApiErrorResponse())
}

@ExceptionHandler(AsyncRequestTimeoutException::class)
fun handleSseAsync(ex: DojoException): ResponseEntity<DojoApiResponse<Any>> {
log.info { "Dojo eat AsyncRequestTimeoutException" }
return ResponseEntity(HttpStatus.OK)
}

private fun DojoException.toApiErrorResponse(): DojoApiErrorResponse = DojoApiErrorResponse(code = errorCode, message = message)

private fun errorResponse(
Expand Down

0 comments on commit 61baf1a

Please sign in to comment.