class DubboParser {

  @Nullable static String errorCode(Throwable error) {
    if (error instanceof RpcException) {
      int code = ((RpcException) error).getCode();
      switch (code) {
        case RpcException.UNKNOWN_EXCEPTION:
          return "UNKNOWN_EXCEPTION";
        case RpcException.NETWORK_EXCEPTION:
          return "NETWORK_EXCEPTION";
        case RpcException.TIMEOUT_EXCEPTION:
          return "TIMEOUT_EXCEPTION";
        case RpcException.BIZ_EXCEPTION:
          return "BIZ_EXCEPTION";
        case RpcException.FORBIDDEN_EXCEPTION:
          return "FORBIDDEN_EXCEPTION";
        case RpcException.SERIALIZATION_EXCEPTION:
          return "SERIALIZATION_EXCEPTION";
        default:
          return String.valueOf(code);
      }
    }
    return null;
  }

}