Why should the instance throwing the exception hold a field with the information? Separation of concerns: optimizer does the computation, then the exception holds what's needed for a full report of the failure.
I would see what makes sense on on case by case basis. For example if the Observer, which is implemented by the client / person using CM, realizes that it can't continue it can throw an application specific exception using a set of Enums that are coded for the application.
if ( optimizer.yourNeverGonnaGetItEver() ) { throw new ApplicationSpecificException(ApplicationErrorCodes.PARTYS_OVER, optimizer); } The error code should be specific enough for the application to understand the the optimizer argument is the optimizer (Object type), and then it can construct the message from there.
Or the report is done at the observer's level, based on complete information routinely returned by the optimizer at every step (cf. previous mail).
I would stick with the same process in this case. Cheers, - Ole --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org