From 922466054b696c06803b73a3a62c093d05800228 Mon Sep 17 00:00:00 2001 From: Morten Stulen Date: Wed, 14 Feb 2024 10:30:10 +0100 Subject: [PATCH] Return 404 on NoResourceFoundException --- .../rest/common/handlers/ControllerAdvice.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/no/nav/tilbakemeldingsmottak/rest/common/handlers/ControllerAdvice.kt b/app/src/main/kotlin/no/nav/tilbakemeldingsmottak/rest/common/handlers/ControllerAdvice.kt index 0d1d1f1a..da1d1fed 100644 --- a/app/src/main/kotlin/no/nav/tilbakemeldingsmottak/rest/common/handlers/ControllerAdvice.kt +++ b/app/src/main/kotlin/no/nav/tilbakemeldingsmottak/rest/common/handlers/ControllerAdvice.kt @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler import org.springframework.web.bind.annotation.ResponseStatus import org.springframework.web.bind.annotation.RestControllerAdvice import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException +import org.springframework.web.servlet.resource.NoResourceFoundException @RestControllerAdvice class ControllerAdvice { @@ -105,7 +106,7 @@ class ControllerAdvice { } // 404 - @ExceptionHandler(value = [ClientErrorNotFoundException::class]) + @ExceptionHandler(value = [ClientErrorNotFoundException::class, NoResourceFoundException::class]) fun notFoundErrorResponse( request: HttpServletRequest, ex: ClientErrorNotFoundException