Disallow catch without parameter ("LastCatch")
Christopher Wright
dhasenan at gmail.com
Sun Oct 25 16:49:27 PDT 2009
grauzone wrote:
> Right now, you can catch every exception with "try { something; } catch
> { somethingelse; }".
>
> Can we get rid of this abomination before D2 is finalized? I claim that
> it's completely useless, and even more so, every single use of this is a
> bug.
>
> If you really want to catch everything, you might as well write "catch
> (Exception o)", or "catch (Throwable o)" for those who know what they're
> doing.
>
> PS: I wonder, should the runtime really execute finally blocks if an
> "Error" exception is thrown? (Errors are for runtime errors, Exception
> for normal exceptions.) Isn't it dangerous to execute arbitrary user
> code in presence of what is basically an internal error?
Are all Errors unrecoverable except by immediately aborting the application?
What about logging?
What about putting up a reasonable error message for the user?
What about restarting the failed module in case the issue was temporary
and environmental?
More information about the Digitalmars-d
mailing list