DubboParser { @Nullable static String errorCode(Throwable error) { if (error instanceof RpcException) { return ERROR_CODE_NUMBER_TO_NAME.get(((RpcException) error).getCode()); } return null; }    }
@Test public void errorCodes() { assertThat(DubboParser.errorCode(null)) .isEqualTo(DubboParser.errorCode(new IOException("timeout"))) .isNull(); assertThat(DubboParser.errorCode(new RpcException(0))) .isEqualTo("UNKNOWN_EXCEPTION"); assertThat(DubboParser.errorCode(new RpcException(1))) .isEqualTo("NETWORK_EXCEPTION"); assertThat(DubboParser.errorCode(new RpcException(2))) .isEqualTo("TIMEOUT_EXCEPTION"); assertThat(DubboParser.errorCode(new RpcException(3))) .isEqualTo("BIZ_EXCEPTION"); assertThat(DubboParser.errorCode(new RpcException(4))) .isEqualTo("FORBIDDEN_EXCEPTION"); assertThat(DubboParser.errorCode(new RpcException(5))) .isEqualTo("SERIALIZATION_EXCEPTION"); assertThat(DubboParser.errorCode(new RpcException(6))) .isEqualTo("NO_INVOKER_AVAILABLE_AFTER_FILTER"); assertThat(DubboParser.errorCode(new RpcException(7))) .isEqualTo("LIMIT_EXCEEDED_EXCEPTION"); assertThat(DubboParser.errorCode(new RpcException(8))) .isEqualTo("TIMEOUT_TERMINATE"); assertThat(DubboParser.errorCode(new RpcException(9))) .isNull(); }