New answers tagged

1

You "only" need a separate exception type if you want to handle it separately. IFF you want to catch a certain exception type separately from other errors, then creating a dedicated type for it (no matter from what it is derived) is the best option IMHO. That being said, I think this is a rather big if for most cases. Especially the ...


1

I would need to inspect the message to see which argument was out of range, and then prompt the user. While this isn't exactly BAD It's certainly a code smell from my PoV. Leaving aside whether you want to handle longitude and latitude errors differently, I would certainly consider one of the following options: a new subclass for each error. In this ...



Top 50 recent answers are included