Class ExceptionFilter

java.lang.Object
org.apache.dubbo.rpc.filter.ExceptionFilter
All Implemented Interfaces:
BaseFilter, BaseFilter.Listener, Filter

@Activate(group="provider") public class ExceptionFilter extends Object implements Filter, BaseFilter.Listener
ExceptionInvokerFilter

Functions:

  1. unexpected exception will be logged in ERROR level on provider side. Unexpected exception are unchecked exception not declared on the interface
  2. Wrap the exception not introduced in API package into RuntimeException. Framework will serialize the outer exception but stringnize its cause in order to avoid of possible serialization problem on client side
  • Constructor Details

    • ExceptionFilter

      public ExceptionFilter()
  • Method Details

    • invoke

      public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException
      Description copied from interface: BaseFilter
      Always call invoker.invoke() in the implementation to hand over the request to the next filter node.
      Specified by:
      invoke in interface BaseFilter
      Throws:
      RpcException
    • onResponse

      public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation)
      Description copied from interface: BaseFilter.Listener
      This method will only be called on successful remote rpc execution, that means, the service in on remote received the request and the result (normal or exceptional) returned successfully.
      Specified by:
      onResponse in interface BaseFilter.Listener
      Parameters:
      appResponse - , the rpc call result, it can represent both normal result and exceptional result
      invoker - , context
      invocation - , context
    • onError

      public void onError(Throwable e, Invoker<?> invoker, Invocation invocation)
      Description copied from interface: BaseFilter.Listener
      This method will be called on detection of framework exceptions, for example, TimeoutException, NetworkException Exception raised in Filters, etc.
      Specified by:
      onError in interface BaseFilter.Listener
      Parameters:
      e - , framework exception
      invoker - , context
      invocation - , context
    • mockLogger

      @DisableInject public void mockLogger(ErrorTypeAwareLogger logger)