Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 8 additions & 34 deletions clickhouse/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,40 +753,14 @@ bool Client::Impl::ReceiveData() {

bool Client::Impl::ReceiveException(bool rethrow) {
std::shared_ptr<Exception> e(new Exception);
Exception* current = e.get();

bool exception_received = true;
do {
bool has_nested = false;

if (!WireFormat::ReadFixed(*input_, &current->code)) {
exception_received = false;
break;
}
if (!WireFormat::ReadString(*input_, &current->name)) {
exception_received = false;
break;
}
if (!WireFormat::ReadString(*input_, &current->display_text)) {
exception_received = false;
break;
}
if (!WireFormat::ReadString(*input_, &current->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);
Expand Down
3 changes: 0 additions & 3 deletions clickhouse/server_exception.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
#pragma once

#include <string>
#include <memory>

namespace clickhouse {
struct Exception {
int code = 0;
std::string name;
std::string display_text;
std::string stack_trace;
/// Pointer to nested exception.
std::unique_ptr<Exception> nested;
};

}
Loading