AssertError

Jarrett Billingsley kb3ctd2 at yahoo.com
Sat Dec 30 08:36:20 PST 2006


"Valery" <valery at freesurf.fr> wrote in message 
news:en60i8$1aav$1 at digitaldaemon.com...
> When I want to unittest the incorrect behaviour of a component, I
> often write something like
>
> try {
>  // this code throws AssertError
> } catch (Error e) { }
>
> What I really want is to catch AssertError instead of Error, but
> is is not in object nor elsewhere in phobos.
>
> Is it possible to catch exactly AssertError ?

It is in Phobos, it's just (very strangely) undocumented.  Use "import 
std.asserterror" and then you can catch AssertErrors.

I'm not sure why this class is not defined in object.d, along with Exception 
and Error.  I mean, it's part of the language. 





More information about the Digitalmars-d mailing list