The Right Approach to Exceptions

Sean Kelly sean at invisibleduck.org
Sun Feb 19 08:44:26 PST 2012


Only a few virtuals--mostly for printing the exception to a log. Any specifics would require catching the exact type. 

On Feb 18, 2012, at 3:30 PM, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:

> On 2/18/12 5:20 PM, Jonathan M Davis wrote:
>> On Saturday, February 18, 2012 17:13:16 Andrei Alexandrescu wrote:
>>> On 2/18/12 4:26 PM, Jonathan M Davis wrote (abridged):
>>> GetOptException
>>> FlagArgumentMissingException
>>> InvalidFlagArgumentException
>>> UnknownFlagException
>>> FileException
>>> FileNotFoundException
>>> NotFileException
>>> NotDirException
>>> AccessDeniedException
>>> 
>>> I died inside a little.
>> 
>> If you actually want to _handle_ exceptions, how else do you expect to do it?
>> Simply put a code of some kind on the exceptions and then have switch
>> statement to handle them?
> 
> The alternative is with virtuals. Do you see a lot of virtuals in base exceptions? Do you see dramatically different interface for different exception types?
> 
> 
> Andrei
> 
> 


More information about the Digitalmars-d mailing list