This is an automated email from the ASF dual-hosted git repository.
ifplusor pushed a commit to branch re_dev
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-cpp.git
The following commit(s) were added to refs/heads/re_dev by this push:
new 6ebfe4c fix: re-throw exception
6ebfe4c is described below
commit 6ebfe4ce2e8dd815a36f0a76777f63acaebf4b10
Author: James Yin <[email protected]>
AuthorDate: Fri Feb 26 15:28:23 2021 +0800
fix: re-throw exception
---
example/AsyncProducer.cpp | 2 +-
src/MQClientAPIImpl.cpp | 4 ++--
src/producer/DefaultMQProducerImpl.cpp | 10 +++++-----
src/transport/TcpRemotingClient.cpp | 8 ++++----
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/example/AsyncProducer.cpp b/example/AsyncProducer.cpp
index cee48ed..6fe5459 100644
--- a/example/AsyncProducer.cpp
+++ b/example/AsyncProducer.cpp
@@ -58,7 +58,7 @@ void AsyncProducerWorker(RocketmqSendAndConsumerArgs* info,
DefaultMQProducer* p
producer->send(msg, callback); // auto delete
} catch (std::exception& e) {
std::cout << "[BUG]:" << e.what() << std::endl;
- throw e;
+ throw;
}
}
}
diff --git a/src/MQClientAPIImpl.cpp b/src/MQClientAPIImpl.cpp
index b25f672..91c6dc1 100644
--- a/src/MQClientAPIImpl.cpp
+++ b/src/MQClientAPIImpl.cpp
@@ -167,7 +167,7 @@ void MQClientAPIImpl::sendMessageAsync(const std::string&
addr,
sendMessageAsyncImpl(cbw, timeoutMillis);
} catch (RemotingException& e) {
deleteAndZero(cbw);
- throw e;
+ throw;
}
}
@@ -268,7 +268,7 @@ void MQClientAPIImpl::pullMessageAsync(const std::string&
addr,
remoting_client_->invokeAsync(addr, request, cbw, timeoutMillis);
} catch (RemotingException& e) {
deleteAndZero(cbw);
- throw e;
+ throw;
}
}
diff --git a/src/producer/DefaultMQProducerImpl.cpp
b/src/producer/DefaultMQProducerImpl.cpp
index 4a2b69c..d3ab73c 100644
--- a/src/producer/DefaultMQProducerImpl.cpp
+++ b/src/producer/DefaultMQProducerImpl.cpp
@@ -180,7 +180,7 @@ SendResult DefaultMQProducerImpl::send(MQMessage& msg, long
timeout) {
return *sendResult;
} catch (MQException& e) {
LOG_ERROR_NEW("send failed, exception:{}", e.what());
- throw e;
+ throw;
}
}
@@ -200,7 +200,7 @@ SendResult DefaultMQProducerImpl::send(MQMessage& msg,
const MQMessageQueue& mq,
return *sendResult;
} catch (MQException& e) {
LOG_ERROR_NEW("send failed, exception:{}", e.what());
- throw e;
+ throw;
}
}
@@ -292,7 +292,7 @@ SendResult DefaultMQProducerImpl::send(MQMessage& msg,
MessageQueueSelector* sel
return *result.get();
} catch (MQException& e) {
LOG_ERROR_NEW("send failed, exception:{}", e.what());
- throw e;
+ throw;
}
}
@@ -345,7 +345,7 @@ TransactionSendResult
DefaultMQProducerImpl::sendMessageInTransaction(MQMessage&
return *sendResult;
} catch (MQException& e) {
LOG_ERROR_NEW("sendMessageInTransaction failed, exception:{}", e.what());
- throw e;
+ throw;
}
}
@@ -774,7 +774,7 @@ SendResult*
DefaultMQProducerImpl::sendKernelImpl(MessagePtr msg,
return sendResult;
} catch (MQException& e) {
- throw e;
+ throw;
}
}
diff --git a/src/transport/TcpRemotingClient.cpp
b/src/transport/TcpRemotingClient.cpp
index 7c3b5c2..c6c222d 100644
--- a/src/transport/TcpRemotingClient.cpp
+++ b/src/transport/TcpRemotingClient.cpp
@@ -231,7 +231,7 @@ std::unique_ptr<RemotingCommand>
TcpRemotingClient::invokeSync(const std::string
} catch (const RemotingSendRequestException& e) {
LOG_WARN_NEW("invokeSync: send request exception, so close the
channel[{}]", channel->getPeerAddrAndPort());
CloseTransport(addr, channel);
- throw e;
+ throw;
} catch (const RemotingTimeoutException& e) {
int code = request.code();
if (code != GET_CONSUMER_LIST_BY_GROUP) {
@@ -240,7 +240,7 @@ std::unique_ptr<RemotingCommand>
TcpRemotingClient::invokeSync(const std::string
channel->getPeerAddrAndPort());
}
LOG_WARN_NEW("invokeSync: wait response timeout exception, the
channel[{}]", channel->getPeerAddrAndPort());
- throw e;
+ throw;
}
} else {
THROW_MQEXCEPTION(RemotingConnectException, "connect to <" + addr + ">
failed", -1);
@@ -294,7 +294,7 @@ void TcpRemotingClient::invokeAsync(const std::string& addr,
} catch (const RemotingSendRequestException& e) {
LOG_WARN_NEW("invokeAsync: send request exception, so close the
channel[{}]", channel->getPeerAddrAndPort());
CloseTransport(addr, channel);
- throw e;
+ throw;
}
} else {
THROW_MQEXCEPTION(RemotingConnectException, "connect to <" + addr + ">
failed", -1);
@@ -343,7 +343,7 @@ void TcpRemotingClient::invokeOneway(const std::string&
addr, RemotingCommand& r
} catch (const RemotingSendRequestException& e) {
LOG_WARN_NEW("invokeOneway: send request exception, so close the
channel[{}]", channel->getPeerAddrAndPort());
CloseTransport(addr, channel);
- throw e;
+ throw;
}
} else {
THROW_MQEXCEPTION(RemotingConnectException, "connect to <" + addr + ">
failed", -1);