Skip to content

Commit

Permalink
Merge pull request #1264 from navikt/more-async-error-handling
Browse files Browse the repository at this point in the history
More async error handling
  • Loading branch information
flexable777 authored Nov 14, 2024
2 parents ba4318e + fb6f05c commit 55ea027
Showing 1 changed file with 9 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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,
Expand Down

0 comments on commit 55ea027

Please sign in to comment.