Interface GlobalExceptionHandler

All Known Implementing Classes:
GlobalExceptionHandlerSlf4j, GlobalExceptionHandlerSysout

public interface GlobalExceptionHandler
Interface used as fallback to handle an error that can not be handled in a specific way by generic components. It allows to write portable code that can delegate error handling to this interface allowing to exchange its implementation and therefore the handling strategy.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handleError(Object context, Throwable error)
    This method handles an error that occurred in a generic component that can not handle it in a specific way.
  • Method Details

    • handleError

      void handleError(Object context, Throwable error)
      This method handles an error that occurred in a generic component that can not handle it in a specific way.
      In a typical server application you may like to log the errors while in a client application you might want to show a popup that displays the error.
      Parameters:
      context - is an Object with information about the context when the error occurred. Its string representation should be human readable and give additional hints to track down the error. E.g. the source or parameters of an operation where the error occurred. This parameter may also be null if no context information is available.
      error - is the error that has been catched and shall be handled.