More exception classes into Phobos?

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Mar 23 17:28:16 PDT 2017


On 3/23/2017 1:45 PM, Adam D. Ruppe wrote:
> I'm of the firm belief that exceptions should NEVER have a string message -
> that's a code smell. If you do it right, all the info can be determined
> automatically by the exception type and passed arguments and *that* is what gets
> printed to string.

The string is what gets printed to the user like:

    "your password has to have at least one upper case character in it"

In general, such is not deducible from the type/arguments.

Exceptions are not for debugging the code (that's what Errors are for), 
Exceptions are for informing the user that he did it wrong.



More information about the Digitalmars-d mailing list