2.17.2: 2011-06-17

net.sf.basedb.util.extensions
Interface ErrorHandler<A extends Action>

All Known Implementing Classes:
LoggingErrorHandlerFactory, RethrowErrorHandlerFactory

public interface ErrorHandler<A extends Action>

Error handlers are created by the factory for each request/use of an extension point. The error handler doesn't have to be thread-safe, but must be if the factory re-uses a single instance. Whenever an exception happens during the processing of an extension, the error is re-directed to the error handler. The error handler is more or less free to do what it wants. The default implementation LoggingErrorHandlerFactory simply puts a message in the log. Note that it is not usually practical to let the error propagate up to the gui level.

Since:
2.17
Author:
Nicklas
Last modified
$Date: 2010-11-12 14:59:38 +0100 (Fri, 12 Nov 2010) $

Method Summary
 void handleError(InvokationContext<? extends A> context, A action, String message, Throwable t)
          Handle an exception that has happened.
 

Method Detail

handleError

void handleError(InvokationContext<? extends A> context,
                 A action,
                 String message,
                 Throwable t)
Handle an exception that has happened. It is up to the error handler what should happen next. Typically, error should always be logged but the error handler may choose to re-throw the exception. If the exception isn't already a runtime exception it must be wrapped.

Note that there are three stages in the extension mechanism, which may cause some of the parameters to be null:

Parameters:
context - The extension context, which can be null
action - The action that was being rendered when the error happened, which can be null
message - An optional error message
t - The error

2.17.2: 2011-06-17