"Nick Sabalausky" <[email protected]> wrote in message
news:[email protected]...
> The only problem I've ever had with them is that there's no templated
> catch blocks, so you can't handle two different exceptions with the same
> code without violating DRY or worse: catching the common base type and
> rethrowing when it's not what you wanted. Toss in templated catch blocks,
> and I've have no problem at all.
>
Do you mean something like this?
try
{
something();
}
catch (e : ThisException, ThatException, OtherException)
{
static assert(is(typeof(e) == CommonType!(ThisException, ThatException,
OtherException));
}
catch (Exception e)
{
// Every other type derived from Exception
}
Or do you think the full power to be able to template catch blocks as if
they were functions would be useful for something?