The Right Approach to Exceptions
deadalnix at gmail.com
Mon Feb 20 13:14:46 PST 2012
Le 20/02/2012 22:05, Andrei Alexandrescu a écrit :
> On 2/20/12 2:31 PM, Juan Manuel Cabo wrote:
>>> Sure. Again, this is not advocating replacement of exception
>>> hierarchies with tables!
>> I think that the case of rethrowing an exception with added detail is
>> the worst
>> enemy of clean Exception hierarchies.
>> The idea of Variant[string] remedies that case without creating a new
>> class just for the added fields. If that case is solved, then the
>> tipical need
>> for creating new exception types that don't really aid selecting them for
>> catching and recovery is solved too.
> Good point. One thing somewhat particular to D, you can always throw a
> new exception linked to the current one.
And this is great design. We should continue in that direction.
More information about the Digitalmars-d