From 61baf1a88dd6ee245cb6b006ff9684b2975d920d Mon Sep 17 00:00:00 2001 From: Junhyoung Lim <109949924+toychip@users.noreply.github.com> Date: Wed, 4 Sep 2024 02:06:35 +0900 Subject: [PATCH] fix: eat AsyncRequestTimeoutException (#129) --- .../com/mashup/dojo/common/ControllerExceptionAdvice.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/src/main/kotlin/com/mashup/dojo/common/ControllerExceptionAdvice.kt b/api/src/main/kotlin/com/mashup/dojo/common/ControllerExceptionAdvice.kt index 6f00efe5..ef765c69 100644 --- a/api/src/main/kotlin/com/mashup/dojo/common/ControllerExceptionAdvice.kt +++ b/api/src/main/kotlin/com/mashup/dojo/common/ControllerExceptionAdvice.kt @@ -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 {} @@ -24,6 +25,12 @@ class ControllerExceptionAdvice { return errorResponse(ex.httpStatusCode, ex.toApiErrorResponse()) } + @ExceptionHandler(AsyncRequestTimeoutException::class) + fun handleSseAsync(ex: DojoException): ResponseEntity> { + log.info { "Dojo eat AsyncRequestTimeoutException" } + return ResponseEntity(HttpStatus.OK) + } + private fun DojoException.toApiErrorResponse(): DojoApiErrorResponse = DojoApiErrorResponse(code = errorCode, message = message) private fun errorResponse(