The Right Approach to Exceptions

Jacob Carlborg doob at
Tue Feb 21 12:42:53 PST 2012

On 2012-02-21 21:27, Andrei Alexandrescu wrote:
> On 2/21/12 2:26 PM, Jacob Carlborg wrote:
>> As I said, it seems you want to push up implementation details specific
>> to a given subclass to the base class even though it shouldn't be pushed
>> up.
> I explained that doing so allows for proper formatting of error
> messages. So it should pushed up.
> Andrei

Well, I don't think that is the right approach. As many others have 
explained, error messages are only a small part of exception handling.

If you do want to have a generic way of getting an error message out of 
an exception, what's wrong with toString? Or a new method that formats 
the error messages. No need to push up the instance variables to the 
base class.

/Jacob Carlborg

More information about the Digitalmars-d mailing list