The Right Approach to Exceptions
yebblies at nospamgmail.com
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 erdani.org> wrote in message
news:jhqaf2$tfk$2 at digitalmars.com...
> On 2/19/12 12:56 AM, Jonathan M Davis wrote:
>> I think that being able to have a catch block which took multiple
>> types would be plenty. There are times when it would be very valuable to
>> able to use the same catch block for multiple exceptions without having
>> catch their base type (which would then potentially catch other
>> which you didn't want to catch). So, something like that second catch
>> that you have there would be very valuable.
> So now hierarchies are not good?
More information about the Digitalmars-d