Added a working @ExceptionHandler
authorKai Moritz <kai@juplo.de>
Sat, 19 Sep 2020 10:46:52 +0000 (12:46 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 3 Oct 2020 10:34:07 +0000 (12:34 +0200)
commit8e7eebe0d72ed85827ea61b943d49b4cf42b85c1
tree2d8338d0c043071cc6f8655b1ac403b15880bb5d
parent0a68bb128fb2ff6f4bdb0bfa890cb576346cc564
Added a working @ExceptionHandler

* Both handlers resolve the handled exception as 503 Internal Server Error
  and are using the template "error/503", which was extended to print a
  message, that the reported exception was catched and handled.
* If one starts the app, it is clearly visible, that the mechanism only
  works for exceptions, that are thrown in the context of the controller.
* Also added a test-case, that shows, that MockMvc shows the expected
  behaviour for exceptions, that are thrown inside the container.
src/main/java/de/juplo/demo/ExampleController.java
src/main/java/de/juplo/demo/ExampleService.java
src/main/resources/templates/400.html [new file with mode: 0644]
src/test/java/de/juplo/demo/ExceptionHandlingApplicationTests.java