Andrej Mitrovic wrote:
The problem is in the e = e.next assignment, not in the code block below it.

On Thu, Aug 19, 2010 at 10:42 PM, Stanislav Blinov
<[email protected]> wrote:
Andrej Mitrovic wrote:
Actually, would this be safe to use? :

   try
   {
       fun();
   }
   catch (Exception e)
   {
       writeln("Primary exception: ", typeid(e));
              while ((e = cast(Exception)e.next) !is null)
       {
           writeln("Collateral exception: ", typeid(e));
       }     }

I'm no expert, but why shouldn't? I'd propose a correction though:

while ((e = e.next) !is null)
{
   if (cast(Exception)e)
   {
       writeln(/*whatever*/);
   }
}

*slap in the head* Silly me.

Reply via email to