The Right Approach to Exceptions

deadalnix deadalnix at gmail.com
Sun Feb 19 03:22:31 PST 2012


Le 19/02/2012 08:05, Andrei Alexandrescu a écrit :
> How about a system in which you can say whether an exception is I/O
> related, network related, recoverable or not, should be displayed to the
> user or not, etc. Such is difficult to represent with inheritance alone.
>

That may sound great on the paper, but it isn't. The fact that an 
exception is recoverable or not depend often on your program and not on 
the cause of the exception. The piece of code throwing the exception 
have no clue if you can recover from that or not.

Exception that cannot be recovered for sure already exists in D. They 
are called errors.

Additionnaly, you'll find recoverable exception with different recovery 
point in the program.


More information about the Digitalmars-d mailing list