diff --git a/clickhouse/client.cpp b/clickhouse/client.cpp index a8ad3400..0922fcce 100644 --- a/clickhouse/client.cpp +++ b/clickhouse/client.cpp @@ -701,7 +701,7 @@ bool Client::Impl::ReceiveData() { } bool Client::Impl::ReceiveException(bool rethrow) { - std::unique_ptr e(new Exception); + std::shared_ptr e(new Exception); Exception* current = e.get(); bool exception_received = true; @@ -742,7 +742,7 @@ bool Client::Impl::ReceiveException(bool rethrow) { } if (rethrow || options_.rethrow_exceptions) { - throw ServerError(std::move(e)); + throw ServerError(e); } return exception_received; diff --git a/clickhouse/exceptions.h b/clickhouse/exceptions.h index f8ee5236..69cc87d6 100644 --- a/clickhouse/exceptions.h +++ b/clickhouse/exceptions.h @@ -40,9 +40,9 @@ class CompressionError : public Error { // Exception received from server. class ServerException : public Error { public: - ServerException(std::unique_ptr e) + ServerException(std::shared_ptr e) : Error(std::string()) - , exception_(std::move(e)) + , exception_(e) { } @@ -59,7 +59,7 @@ class ServerException : public Error { } private: - std::unique_ptr exception_; + std::shared_ptr exception_; }; using ServerError = ServerException;