Open rsenden opened 2 years ago
Non-20x responses now generate an exception. We have chosen to just propagate the exception to the user, rather than trying to wrap it in the configured output format. This ensures that processing is interrupted and appropriate error code is returned.
We still need to review the use of SneakyThrows
, and verify that (fatal) exceptions are written to the logs.
When encountering an error, we mostly throw standard Java exceptions like IllegalStateException/IllegalArgumentException, with hardcoded messages. Better would be to use custom exceptions that include a message resource key, to allow for internationalization of the error messages.
We only support English language for now, so the ability to support internationalized error messages is low priority for now. Eventually we should come up with some generic best practices for error & exception management, but again low priority for now.
Tasks:
HTTP response codes:
Exception handling:
@SneakyThrows
, do we want to use this?