Reputation: 67223
I read a thread on this topic on this very forum which listed some reasons to use custom exceptions but none of them really seemed strong reasons (can't remember the reasons now).
So why would you use custom exceptins? In particular, I have never understood the decision making process between using a standard or custom exception to indicate a shopping basket is null (I think a custom one is used as an empty collection is not exceptional and this is a business process thing). More clarification is needed, however.
Thanks
Upvotes: 2
Views: 138
Reputation: 498992
Here is my take:
In regards to things like null arguments - I would never use a custom exception. The NullArgumentException (.NET) / IllegalArgumentException (Java) is perfectly satisfactory.
Jared Par has a blog entry about this, here.
Upvotes: 4