Collateral Exceptions, Throwable vs Exception

Sean Kelly sean at invisibleduck.org
Thu Aug 19 14:11:16 PDT 2010


Andrej Mitrovic Wrote:

> Yes, I've added it as Throwable. But there's one more problem with
> your code, this:
> 
> catch (Throwable e)     // have to use Throwable for collateral exceptions
>                             // or maybe use a cast like below
>     {
>         writeln("Primary exception: ", typeid(e), " ", e);
> 
>         while ((e = e.next) !is null)
>         {
>             writeln("Collateral exception: ", typeid(e), " ", e);
>         }
>     }
> 
> Will output ~5000 lines of "Exception .." stuff. Oh and in the book it
> looks like you're counting from 100 to 1 (for the throws from gun),
> which makes sense. Yet I'm getting back output from 1 to 100. Not sure
> what's going on there..

Are these stack trace lines or actual distinct exceptions?


More information about the Digitalmars-d mailing list