fortify / fcli

fcli is a command-line utility for interacting with various Fortify products
https://fortify.github.io/fcli/
Other
27 stars 16 forks source link

Code Quality: Error & exception handling #15

Open rsenden opened 2 years ago

rsenden commented 2 years ago

Tasks:

rsenden commented 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.

rsenden commented 1 year ago

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.

rsenden commented 11 months ago

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.