The Right Approach to Exceptions
dawg at dawgfoto.de
Sat Feb 18 11:12:43 PST 2012
On Sat, 18 Feb 2012 19:52:05 +0100, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> There's a discussion that started in a pull request:
> Let's come up with a good doctrine for exception defining and handling
> in Phobos. From experience I humbly submit that catching by type is most
> of the time useless.
Exception are useful for handling unknown errors and probably to bundle
error handling at a bigger scope.
You don't want to use specific exceptions because it couples unrelated
The distinction of recoverable Exceptions and non-recoverable Errors is
in most cases.
Typed exception being used for local error recovery is about the same as
error codes but at a bigger expense. On the plus side exception can carry
specific error messages, which could be solved for error codes too.
More information about the Digitalmars-d