The Right Approach to Exceptions
dennis luehring
dl.soluz at gmx.net
Mon Feb 20 10:19:00 PST 2012
Am 20.02.2012 19:02, schrieb H. S. Teoh:
> Exactly! Just because you use a Variant doesn't magically free you from
> needing to know what exactly is that exception that you caught in the
> first place. To make any sense of what's stored in the Variant, you
> still have to know what is the exception type, and based on the type
> interpret the Variant. So you end up with:
>
> catch(Exception e) {
> switch(e.type) {
> case BlahException:
> handleBlahException(e.data.blah_info);
> break;
> case BlehException:
> handleBlehException(e.data.bleh_info);
> break;
> case BluhException:
> handleBluhException(e.data.bluh_info);
> break;
> ...
> }
> }
Thx Teoh - i also don't know how Andreis Variant[string] would help here
in any way
More information about the Digitalmars-d
mailing list