Standard exception hierarchy
kris
foo at bar.com
Thu Mar 29 19:20:32 PDT 2007
Alberto Bertogli wrote:
> On Tue, Mar 27, 2007 at 03:09:38PM -0300, Leandro Lucarella wrote:
>
>>Is there any standard D exception hierarchy? If not, I think it's a good
>>time to have one, because D is getting popular and people will start
>>making it's own exception hierarchy and that would be too hard to change
>>if D gets a standard hierarchy later.
>
>
> I started to play with D last week and ran into this very quickly. I was
> writing bindings for some application I wrote
> (http://auriga.wearlab.de/~alb/nmdb/ is the app, you can browse the
> bindings at http://repo.or.cz/w/nmdb.git?a=tree;f=d) and I needed to
> raise an exception where a key in some kind of associative array was not
> found.
>
> I looked up to see the standard hierarchy only to found out there was
> none, which was a bit of a bummer (the biggest one so far, because D
> looks quite nice).
>
> Then I tried to use the same one used by the standard data type, but it
> required I give a file and a line number to it, which wasn't very clean
> either.
>
> Finally I had to implement my own, but it would have been much better to
> have some standard hierarchy to use, or at least to have as a
> "recommended style reference" for names and inheritance.
>
> Are there any plans to work on this?
>
> Thanks,
> Alberto
>
>
Tango has an extended set of pre-defined exceptions for this reason, and
they live in tango.core.Exception. You might find something there to
meet your needs?
e.g. IllegalElementException, NoSuchElementException, and
IllegalArgumentException
More information about the Digitalmars-d
mailing list