Community
Chat Logs
Monday, July 6, 2026
- acidjnkhello - in my Spring Boot application, I want to have defensive code in the @ControllerAdvice inheriting from ResponseEntityExceptionHandler for "can't happen" situations. Like an actual bug that causes an unexpected exception, forgotten validation of client data. Would you rather make a unit test with mocking, or add a special endpoint class only to src/test that generates all exceptions needed for @SpringBootTest?
- sonOfRaI wouldn't write a test for this thing, I would just assume that whatever Spring gives you for unhandled exception handling actually works
- acidjnkI find that unsatisfying for clients, like an Angular or React application, for example. They need to rely on an API contract, e. g. that I provide certain fields in the response object so they can display the proper error message.
- acidjnkAlthough could argue that the client should expect 500 and so something proper with it, no matter what else it contains.
- ernimrilacidjnk, there are typically many things between your server and the client all of them can crash or rewrite the content....
- ernimrilacidjnk, a client that does not handle 500 responses is not a good client
- acidjnkthis is not really readable, is it? https://pastebin.com/6KyRWJ9L elegant in a way, but with Java syntax, not clear that it is a simple carthesian product of (GET,PUT)x(thing1,thing2,thing3,...)