Exception Hierarchy [WAS: Re: Top 5]

Sean Kelly sean at invisibleduck.org
Thu Oct 16 11:10:15 PDT 2008


Denis Koroskin wrote:
> On Thu, 16 Oct 2008 19:07:12 +0400, Sean Kelly <sean at invisibleduck.org> 
> wrote:
> 
>> Bruno Medeiros wrote:
>>>  I agree there should be a distinction between recoverable exceptions 
>>> (normal exceptions) and nonrecoverable exceptions (contract 
>>> failures?). I agree that "Exception" should be the name for normal 
>>> exceptions. The others could be named "Error" or "Failure".
>>> If we want the ability to catch these two separately, I don't see any 
>>> other way other than having a third, top-level class, ie, a 
>>> "Throwable", from which Exception and Error/Failure derive from.
>>
>> This is exactly the design that was decided upon.
> 
> Will we still be able to throw Object? Is Throwable an interface or a 
> class?

Throwable is a class, and contains all the stuff that Exception once 
contained: message, file, line, a "next" reference, and trace info.  And 
it sounds like Walter may require that all thrown objects in D be a 
descendant of Throwable, but that won't happen immediately.


Sean



More information about the Digitalmars-d mailing list