Collateral Exceptions, Throwable vs Exception
Stanislav Blinov
stanislav.blinov at gmail.com
Thu Aug 19 13:42:47 PDT 2010
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