digitalmars.D - error vs exception
- Ben Hinkle (21/21) Aug 23 2004 I'm confused about what D calls errors and exceptions. Part of the chang...
- Sean Kelly (5/25) Aug 23 2004 I'm not sure. Though doFormat (a relatively new addition) throws an exc...
- Ben Hinkle (5/8) Aug 24 2004 holy shiskabobs - you're right. Well, looks like I'll send Walter anothe...
- Stewart Gordon (8/11) Aug 26 2004 Recoverable by whom - the app or the programmer?
I'm confused about what D calls errors and exceptions. Part of the changes that I've made to std.stream involve changing the Error subclasses to Exception subclasses and I want to make sure this is the right thing to do. Now, the doc http://www.digitalmars.com/d/errors.html talks about the class Error and how it can be caught and handled. It also says all errors subclass Error. So that makes me think Errors are recoverable. But then in object.d the source code says: // Recoverable errors class Exception : Object ... // Non-recoverable errors class Error : Exception ... I'm used to Exceptions being thrown/caught willy-nilly and Errors being really serious problems that cause the app to abort. In D is it reversed? If so then I'll back out my std.stream changes. Also I suggest some more details in the errors.html doc about the different classes involved and maybe even rename Exception to NonRecoverableError or something (or vide-versa rename Error to NonRecoverableException). Note I don't want to start a thread about the abstract concepts of recoverable vs non-recoverable errors - I just want to know how those concepts map to D. -Ben
Aug 23 2004
In article <cgcs6d$2ele$1 digitaldaemon.com>, Ben Hinkle says...I'm confused about what D calls errors and exceptions. Part of the changes that I've made to std.stream involve changing the Error subclasses to Exception subclasses and I want to make sure this is the right thing to do. Now, the doc http://www.digitalmars.com/d/errors.html talks about the class Error and how it can be caught and handled. It also says all errors subclass Error. So that makes me think Errors are recoverable. But then in object.d the source code says: // Recoverable errors class Exception : Object ... // Non-recoverable errors class Error : Exception ... I'm used to Exceptions being thrown/caught willy-nilly and Errors being really serious problems that cause the app to abort. In D is it reversed? If so then I'll back out my std.stream changes. Also I suggest some more details in the errors.html doc about the different classes involved and maybe even rename Exception to NonRecoverableError or something (or vide-versa rename Error to NonRecoverableException). Note I don't want to start a thread about the abstract concepts of recoverable vs non-recoverable errors - I just want to know how those concepts map to D.I'm not sure. Though doFormat (a relatively new addition) throws an exception derived from Error, so I'm guessing that Walter currently considers Errors to be recoverable no matter what the comment says. Sean
Aug 23 2004
I'm not sure. Though doFormat (a relatively new addition) throws anexceptionderived from Error, so I'm guessing that Walter currently considers Errorsto berecoverable no matter what the comment says.holy shiskabobs - you're right. Well, looks like I'll send Walter another version of std.stream with the old Error subclasses. Plus I'll start updating all my code to use Error subclasses instead of Exceptions.
Aug 24 2004
Sean Kelly wrote: <snip>I'm not sure. Though doFormat (a relatively new addition) throws an exception derived from Error, so I'm guessing that Walter currently considers Errors to be recoverable no matter what the comment says.Recoverable by whom - the app or the programmer? A FormatError strikes me as an indication of a bug. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Aug 26 2004