Leif Mortenson wrote:
Berin Loritsch wrote:

I think I have a better idea.  How about adding a CommandFailureHandler
to the CommandManager?

Currently all exceptions are ignored by the CommandManager, but this
way we can have any application customize what it chooses to do in
the event of a failure. The return value will be a boolean value
for whether to close the CommandManager or not.


I like this. If the displaying of the error was done in the default handler, then
I could simply configure my own handler and it would be easy to display as
much or as little as I want. That should make everyone happy.


What parameters would be available in that context?

boolean commandFailed( Throwable t, String role );
Something like that?  I have not looked at the code that closely.

It would look like this:



/**
* CommandFailureHandler is used by the CommandManager to handle any exceptions that might
* be thrown by a Command. That way the application using the CommandManager can properly
* manage what happens when an exception is thrown.
*
* @author <a href="bloritsch.at.apache.org">Berin Loritsch</a>
* @version CVS Revision: 1.1 $
*/
public interface CommandFailureHandler
{
/**
* Handle a command failure. If a command throws an exception, it has failed. The
* CommandManager will call this method so that we can handle the problem effectively.
*
* @param command The original Command object that failed
* @param throwable The throwable that caused the failure
* @return <code>true</code> if the CommandManager should cease to process commands.
*/
boolean handleCommandFailure(final Command command, final Throwable throwable);
}



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to