You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2019/09/04 13:08:33 UTC

[GitHub] [commons-lang] garydgregory edited a comment on issue #450: Add and use IllegalArgumentExceptions

garydgregory edited a comment on issue #450: Add and use IllegalArgumentExceptions
URL: https://github.com/apache/commons-lang/pull/450#issuecomment-527892606
 
 
   In the case of `IllegalArgumentException`, based on the usage within Commons Lang, and in the code bases I've worked on and currently see, `IllegalArgumentException` is used quite often. As you can see from this PR, there are quite a number of files that benefit from this short cut.
   
   `RuntimeException` feels like a code smell to me, one should only rarely consider throwing such a generic exception, I'd even say it's an anti-pattern.
   
   As a provider of a fairly general purpose library we have to find the balance between being general but also following the YAGNI principle. IMO, `RuntimeException` is not only YAGNI but also an anti-pattern. Extending outlook to other exceptions is fair and I would consider doing the same for other fairly general purpose exceptions like `NullPointerException` and `IllegalStateException`. This is just a small step.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services