Collateral Exceptions, Throwable vs Exception

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Aug 19 15:48:15 PDT 2010


On 08/19/2010 03:45 PM, 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..

The reverse ordering seems to be a bug in the implementation.

Andrei


More information about the Digitalmars-d mailing list