@Nullable
  public static IOException getControllerException(RpcController controller) throws IOException {
    if (controller == null || !controller.failed()) {
      return null;
    }
    if (controller instanceof ServerRpcController) {
      return ((ServerRpcController) controller).getFailedOn();
    }
    return new DoNotRetryIOException(controller.errorText());
  }
Retreivies exception stored during RPC invocation.
@param controller the controller instance provided by the client when calling the service
@return exception if any, or null; Will return DoNotRetryIOException for string represented
        failure causes in controller.
hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/CoprocessorRpcUtils.java