Collateral Exceptions, Throwable vs Exception
Stanislav Blinov
stanislav.blinov at gmail.com
Thu Aug 19 13:53:28 PDT 2010
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
> <stanislav.blinov at gmail.com> 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.
More information about the Digitalmars-d
mailing list