Remove IllegalArgumentException in favour of an application exception that extends IllegalArgumentException #222
Labels
Status: In Discussion
Tag individuals in the comments you wish to discuss issue with
Type: Enhancement
SDK you're using (please complete the following information):
Is your feature request related to a problem? Please describe.
IllegalArgumentException should be thrown when a value is provided to an argument that just doesn’t quite work within the business logic of the application, but the exception itself is strictly illegal from the perspective of the JVM.
When an IllegalArgumentException is thrown, we expect that there is an issue in the JVM when handling the argument (and not necessarily the application); Eg. when method that accepts an String parameter is called with an Integer.
Describe the solution you'd like
Create an application exception (Eg. XeroIllegalArgumentException) that extends IllegalArgumentException. This is a better way to implement IllegalArgumentException as this indicates that the argument is illegal from the perspective of the application (and not from the perspective of the JVM)
Additional context
Application monitoring systems (like New Relic, Datadog, etc) can be configured to automatically treat most exceptions in the java.lang.* package as exceptions that relate to an issue in the JVM, and they can be infrastructure related exceptions (and not application business logic exceptions). Applications should expend java.lang.* exceptions for exceptions that relate to the application.
I think this feature request should have status In Discussion for other input.
The text was updated successfully, but these errors were encountered: