diff options
| author | Paul-Christian Volkmer | 2025-12-01 16:06:48 +0100 |
|---|---|---|
| committer | GitHub | 2025-12-01 16:06:48 +0100 |
| commit | 9a8da248c04f47ff30db6da22b035894294499d3 (patch) | |
| tree | 3efdd2abfc56265d606a48bec9f170127d6b5f12 | |
| parent | b85f5fe60e9c2809b513304c73a86200c91b1c2d (diff) | |
fix: show error page (#207)
This shows error page when trying to load unavailable resource.
| -rw-r--r-- | src/main/kotlin/dev/dnpm/etl/processor/web/ApplicationControllerAdvice.kt | 5 | ||||
| -rw-r--r-- | src/main/resources/templates/errors/404.html | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/web/ApplicationControllerAdvice.kt b/src/main/kotlin/dev/dnpm/etl/processor/web/ApplicationControllerAdvice.kt index 0dec30e..e81b348 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/web/ApplicationControllerAdvice.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/web/ApplicationControllerAdvice.kt @@ -24,10 +24,11 @@ import org.springframework.http.HttpStatus import org.springframework.web.bind.annotation.ControllerAdvice import org.springframework.web.bind.annotation.ExceptionHandler import org.springframework.web.bind.annotation.ResponseStatus +import org.springframework.web.servlet.resource.NoResourceFoundException @ControllerAdvice class ApplicationControllerAdvice { - @ExceptionHandler(NotFoundException::class) + @ExceptionHandler(NotFoundException::class, NoResourceFoundException::class) @ResponseStatus(HttpStatus.NOT_FOUND) - fun handleNotFoundException(e: NotFoundException): String = "errors/404" + fun handleNotFoundException(e: Exception): String = "errors/404" } diff --git a/src/main/resources/templates/errors/404.html b/src/main/resources/templates/errors/404.html index 530d030..713239d 100644 --- a/src/main/resources/templates/errors/404.html +++ b/src/main/resources/templates/errors/404.html @@ -9,6 +9,9 @@ <div th:replace="~{fragments.html :: nav}"></div> <main> <h1>Nichts gefunden</h1> + <p> + Die angeforderte Ressource oder Seite ist nicht vorhanden. + </p> </main> <footer th:replace="~{fragments.html :: footer}"></footer> </body> |
