diff --git a/clickhouse/client.cpp b/clickhouse/client.cpp index b41e0ba3..74e74dc3 100644 --- a/clickhouse/client.cpp +++ b/clickhouse/client.cpp @@ -753,40 +753,14 @@ bool Client::Impl::ReceiveData() { bool Client::Impl::ReceiveException(bool rethrow) { std::shared_ptr e(new Exception); - Exception* current = e.get(); - - bool exception_received = true; - do { - bool has_nested = false; - - if (!WireFormat::ReadFixed(*input_, ¤t->code)) { - exception_received = false; - break; - } - if (!WireFormat::ReadString(*input_, ¤t->name)) { - exception_received = false; - break; - } - if (!WireFormat::ReadString(*input_, ¤t->display_text)) { - exception_received = false; - break; - } - if (!WireFormat::ReadString(*input_, ¤t->stack_trace)) { - exception_received = false; - break; - } - if (!WireFormat::ReadFixed(*input_, &has_nested)) { - exception_received = false; - break; - } - - if (has_nested) { - current->nested.reset(new Exception); - current = current->nested.get(); - } else { - break; - } - } while (true); + bool has_nested = false; // obsolete: https://github.com/ClickHouse/ClickHouse/blob/ef11941cf5a/src/IO/ReadHelpers.cpp#L2017 + + bool exception_received = + WireFormat::ReadFixed(*input_, &e->code) + && WireFormat::ReadString(*input_, &e->name) + && WireFormat::ReadString(*input_, &e->display_text) + && WireFormat::ReadString(*input_, &e->stack_trace) + && WireFormat::ReadFixed(*input_, &has_nested); if (events_) { events_->OnServerException(*e); diff --git a/clickhouse/server_exception.h b/clickhouse/server_exception.h index dcc97c51..89aff052 100644 --- a/clickhouse/server_exception.h +++ b/clickhouse/server_exception.h @@ -1,7 +1,6 @@ #pragma once #include -#include namespace clickhouse { struct Exception { @@ -9,8 +8,6 @@ struct Exception { std::string name; std::string display_text; std::string stack_trace; - /// Pointer to nested exception. - std::unique_ptr nested; }; }