exception types & objects

spir denis.spir at gmail.com
Tue Oct 19 11:30:35 PDT 2010


On Tue, 19 Oct 2010 14:52:20 +0200
"Simen kjaeraas" <simen.kjaras at gmail.com> wrote:

> > I was expecting (from exp with other language) there to be a root Error  
> > or Exception type implementating base exception mechanics and/or an  
> > imposed interface to comply with (esp a kind of string method returning  
> > what text to write out when the exception is not caught).
> > How does this work, and how to use it concretely?  
> 
> There is a base class Exception and Error, as well as the base interface
> Throwable, which the aforementioned implement. Using this is more of a
> convention than absolute necessity, but it is used all over Phobos and
> druntime, and it is heavily discouraged not to use those as bases.

Good. Is this documented somewhere (have searched language and library references before asking: found some documents on peculiar aspects, but none describing the mechanism and how to use).

> On a sidenote, one should usually only catch Exceptions, not Errors, as
> the latter is supposed to be used for non-recoverable errors.

Very well, this matches my point of view.

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d-learn mailing list