exception types & objects

spir denis.spir at gmail.com
Tue Oct 19 05:13:54 PDT 2010


Hello,

The reference states:

ThrowStatement:
	throw Expression ;
Expression is evaluated and must be an Object reference. The Object reference is thrown as an exception.
	throw new Exception("message");

The example uses an Excpetion type, but the somewhat comment contradicts it. Can one really use any kind of object as exception? How does D then handle it? 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?

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

spir.wikidot.com



More information about the Digitalmars-d-learn mailing list