The Right Approach to Exceptions

Jonathan M Davis jmdavisProg at
Mon Feb 20 10:32:10 PST 2012

On Monday, February 20, 2012 12:00:11 Andrei Alexandrescu wrote: 
> This does not pit typed exceptions against uniform interfaces. The hash
> simply provides information in a uniform format across exception types.
> That way, code that needs to extract and format information in a generic
> manner can be written in one place.

I want fields with information about what went wrong and what the applicable 
state was when things went wrong - like the socket and port you were using or 
what the bad data was. Why would shoving that in an external table help? It 
should go with the instance of the exception.

And if all you're talking about is externalizing the error message but still 
having the fields in the exception, then that's still worse, because it makes 
it harder to view the message in a debugger. And because exception messages 
are meant for _developers_, not users, I don't think that stuff like 
internationalization is particularly applicable.

- Jonathan M Davis

More information about the Digitalmars-d mailing list