diff --git a/src/main/kotlin/no/nav/klage/oppgave/config/ProblemHandlingControllerAdvice.kt b/src/main/kotlin/no/nav/klage/oppgave/config/ProblemHandlingControllerAdvice.kt index 9384b3dfa..65300f9b9 100644 --- a/src/main/kotlin/no/nav/klage/oppgave/config/ProblemHandlingControllerAdvice.kt +++ b/src/main/kotlin/no/nav/klage/oppgave/config/ProblemHandlingControllerAdvice.kt @@ -8,6 +8,7 @@ import org.springframework.http.ProblemDetail import org.springframework.web.bind.annotation.ExceptionHandler import org.springframework.web.bind.annotation.RestControllerAdvice import org.springframework.web.context.request.NativeWebRequest +import org.springframework.web.context.request.async.AsyncRequestNotUsableException import org.springframework.web.reactive.function.client.WebClientResponseException import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler @@ -19,37 +20,14 @@ class ProblemHandlingControllerAdvice : ResponseEntityExceptionHandler() { private val secureLogger = getSecureLogger() } -// @ExceptionHandler -// fun catchISE( -// ex: IllegalStateException, -// request: NativeWebRequest -// ): ProblemDetail { -// logger.debug("catching IllegalStateException", ex) -// -// if (ex.cause is SizeLimitExceededException) { -// return create(HttpStatus.PAYLOAD_TOO_LARGE, ex) -// } -// -// try { -// val nativeRequest = request.nativeRequest -// -// if (nativeRequest is HttpServletRequest) { -// logger.debug("dispatcherType = " + nativeRequest.dispatcherType?.name) -// -// logger.debug("path = " + nativeRequest.pathInfo) -// logger.debug("requestURI = " + nativeRequest.requestURI) -// -// if (nativeRequest.isAsyncStarted) { -// logger.debug("asyncContext = " + nativeRequest.asyncContext) -// } -// } -// } catch (e: Exception) { -// logger.warn("problems with handling ISE", e) -// } -// -// return create(HttpStatus.INTERNAL_SERVER_ERROR, ex) -// } -// + @ExceptionHandler + fun handleAsyncRequestNotUsableException( + ex: AsyncRequestNotUsableException, + request: NativeWebRequest + ) { + secureLogger.debug("Suppressing AsyncRequestNotUsableException. This is probably due to lost client during async/SSE operations.", ex) + } + @ExceptionHandler fun handleSizeLimitExceededException( ex: AttachmentTooLargeException,