Collateral Exceptions, Throwable vs Exception
Andrej Mitrovic
andrej.mitrovich at gmail.com
Thu Aug 19 13:46:54 PDT 2010
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*/);
> }
> }
>
More information about the Digitalmars-d
mailing list