Interface ErrorHandler

All Known Implementing Classes:
ClassMapErrorHandler, SimpleErrorHandler

public interface ErrorHandler
An interface to make it easier to implement dynamic error handling. A typical implementation allows the registration of one or more error handlers. When an exception is thrown the handleError(Throwable) method is invoked on the first error handler. There are three outcomes:
  • The error handler has decided that the error is unrecoverable and re-throws the same (or another) exception.
  • The error handler could handle the error and returns TRUE to indicate that processing should continue. No more error handlers should be invoked.
  • The error handler doesn't know what to do and returns FALSE. The next error handler should be invoked and if no more are available the exception should be rethrown.
Version:
2.0
Author:
nicklas
Last modified
$Date: 2008-09-11 22:08:14 +0200 (to, 11 sep 2008) $
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Handle an error.
  • Method Details

    • handleError

      boolean handleError(Throwable t) throws Throwable
      Handle an error. If it is decided that the error is a final error this method should rethrow the same or a different exception. If if is decided that it is possible to continue with the current operation true should be returned. If false is returned it indicates that this error handled doesn't know how to handle the error. The caller should try another error handler or throw an exception.
      Parameters:
      t - The error to handle
      Returns:
      TRUE if the error was handled successfully and the execution should continue with the next item
      Throws:
      Throwable - If the error is final and can't be solved