Skip to content

Commit f0bafab

Browse files
committed
Using shared_ptr in exception class
1 parent f606f9a commit f0bafab

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clickhouse/client.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ bool Client::Impl::ReceiveData() {
701701
}
702702

703703
bool Client::Impl::ReceiveException(bool rethrow) {
704-
std::unique_ptr<Exception> e(new Exception);
704+
std::shared_ptr<Exception> e(new Exception);
705705
Exception* current = e.get();
706706

707707
bool exception_received = true;
@@ -742,7 +742,7 @@ bool Client::Impl::ReceiveException(bool rethrow) {
742742
}
743743

744744
if (rethrow || options_.rethrow_exceptions) {
745-
throw ServerError(std::move(e));
745+
throw ServerError(e);
746746
}
747747

748748
return exception_received;

clickhouse/exceptions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class CompressionError : public Error {
4040
// Exception received from server.
4141
class ServerException : public Error {
4242
public:
43-
ServerException(std::unique_ptr<Exception> e)
43+
ServerException(std::shared_ptr<Exception> e)
4444
: Error(std::string())
45-
, exception_(std::move(e))
45+
, exception_(e)
4646
{
4747
}
4848

@@ -59,7 +59,7 @@ class ServerException : public Error {
5959
}
6060

6161
private:
62-
std::unique_ptr<Exception> exception_;
62+
std::shared_ptr<Exception> exception_;
6363
};
6464
using ServerError = ServerException;
6565

0 commit comments

Comments
 (0)