On 2/21/12 2:42 PM, Jacob Carlborg wrote:
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.

I agree. Also, one interface function is only a small part of a class hierarchy.

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.

This has been answered in the long thread. In brief, toString loses too much information and putting formatting inside exceptions is not the right place.


Andrei


Reply via email to