The Right Approach to Exceptions

Daniel Murphy yebblies at
Sun Feb 19 00:51:53 PST 2012

The issue here isn't deep vs. flat hierarchy (like the rest of the thread), 
it's about improving code clarity/dry.

This is much like the 'case A, B:' syntax (or fallthrough/goto case) in 

Even with a flat hierarchy, you might still want to handle a set of 
exceptions deriving from Exception the same way, but don't want to catch 
everything derived from Exception.

"Andrei Alexandrescu" <SeeWebsiteForEmail at> wrote in message 
news:jhqaf2$tfk$2 at
> On 2/19/12 12:56 AM, Jonathan M Davis wrote:
>> I think that being able to have a catch block which took multiple 
>> exception
>> types would be plenty. There are times when it would be very valuable to 
>> be
>> able to use the same catch block for multiple exceptions without having 
>> to
>> catch their base type (which would then potentially catch other 
>> exceptions
>> which you didn't want to catch). So, something like that second catch 
>> block
>> that you have there would be very valuable.
> So now hierarchies are not good?
> Andrei 

More information about the Digitalmars-d mailing list