diff --git a/client/src/main/java/org/apache/rocketmq/client/exception/MQBrokerException.java b/client/src/main/java/org/apache/rocketmq/client/exception/MQBrokerException.java index 5db60e383a1e8bcadb37052e46a6cf969adbfeca..f07a38b81f0a3689015eed3ac63f6f2fb12cb457 100644 --- a/client/src/main/java/org/apache/rocketmq/client/exception/MQBrokerException.java +++ b/client/src/main/java/org/apache/rocketmq/client/exception/MQBrokerException.java @@ -25,6 +25,14 @@ public class MQBrokerException extends Exception { private final String errorMessage; private final String brokerAddr; + public MQBrokerException(int responseCode, String errorMessage) { + super(FAQUrl.attachDefaultURL("CODE: " + UtilAll.responseCode2String(responseCode) + " DESC: " + + errorMessage)); + this.responseCode = responseCode; + this.errorMessage = errorMessage; + this.brokerAddr = null; + } + public MQBrokerException(int responseCode, String errorMessage, String brokerAddr) { super(FAQUrl.attachDefaultURL("CODE: " + UtilAll.responseCode2String(responseCode) + " DESC: " + errorMessage + (brokerAddr != null ? " BROKER: " + brokerAddr : ""))); diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java b/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java index 8ae90574e20210f48ae565c3c7a1adc408cbad26..7a4d55654105b7449bebe4ca4a7eb17933466c1c 100644 --- a/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java +++ b/client/src/main/java/org/apache/rocketmq/client/impl/MQClientAPIImpl.java @@ -1340,7 +1340,7 @@ public class MQClientAPIImpl { break; } - throw new MQBrokerException(response.getCode(), response.getRemark(), null); + throw new MQBrokerException(response.getCode(), response.getRemark()); } public TopicRouteData getDefaultTopicRouteInfoFromNameServer(final String topic, final long timeoutMillis)