The Right Approach to Exceptions
Nathan M. Swan
nathanmswan at gmail.com
Sat Feb 18 11:18:53 PST 2012
On Saturday, 18 February 2012 at 18:52:05 UTC, Andrei
Alexandrescu wrote:
> There's a discussion that started in a pull request:
>
> https://github.com/alexrp/phobos/commit/4b87dcf39efeb4ddafe8fe99a0ef9a529c0dcaca
>
> 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.
>
>
> Andrei
Here's a compromise I would suggest: we have the different
exception types for different exceptional behaviors, but still
they all descend from a common exception type that has a field
with the module name; this way, the client can choose which way
they want to go.
It would be nice if there was a mixin template that creates an
exception class that acts like this; making similar exception
classes is annoying.
More information about the Digitalmars-d
mailing list