New answers tagged hierarchy
Throw the most specific exception that already exists. It does no harm to the caller who doesn't care and will just catch the more general common superclass, but adds useful extra flexibility to a caller that distinguishes between them. Be eager to change existing code from general → specific. It shouldn't break code, after all. Be wary of changing ...
Top 50 recent answers are included