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 (fr, 12 nov 2010) $
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handleError(InvokationContext<? extends A> context, A action, String message, Throwable t)
    Handle an exception that has happened.
  • Method Details

    • 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:

      • Extension point intialization: Eg. when the render factory is being prepared (context and action are both null)
      • Extension intialization: Eg. when the action factory is being prepared (action is null)
      • Extension rendering: Eg. when rendering the actions of a single extension (context and action are non-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