More exception classes into Phobos?

Георгий via Digitalmars-d digitalmars-d at puremagic.com
Thu Mar 23 02:31:23 PDT 2017


Hi everyone.
I previously made the dub package 
https://georgy7.github.io/exceptions/exceptions.html
because many languages have the useful standard 
NotImplementedException (UnsupportedOperationException), 
ArgumentException (IllegalArgumentException), IOException. It's 
easy to catch by type.

What do you thing about to include these three exceptions in 
Phobos as the base for user exceptions.

Maybe, ArgumentException is not very suitable name for an 
exception in D, because the language has the contracts. So, 
actually, an assert will throw an Exception, when there is a bad 
argument, isn't it?
When we use IllegalArgumentException in Java at work, we actually 
mean "bad user input" in most cases. So, I would name it 
UserInputException.

Also, I saw the DIP33 https://wiki.dlang.org/DIP33
It proposes the complex class hierarchy. I have no thoughts about 
it.

Well, I just suggest to add these 3 classes in std.exception.

NotImplementedException : Exception
UserInputException : Exception
IOException : Exception

What do you think?


More information about the Digitalmars-d mailing list