From 27f59d66c3fade946891cb9762b41369eeed5eca Mon Sep 17 00:00:00 2001 From: Andrew Slabko Date: Wed, 10 Dec 2025 08:47:47 +0100 Subject: [PATCH] Hide exceptions in ~Client `~Client` can throw producing all sorts for problems. To avoid that, we ignore exceptions in the destructor, similar to how it is done in std::fstream. --- clickhouse/client.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clickhouse/client.cpp b/clickhouse/client.cpp index 0fdfc49d..a8c8ea64 100644 --- a/clickhouse/client.cpp +++ b/clickhouse/client.cpp @@ -289,8 +289,10 @@ Client::Impl::Impl(const ClientOptions& opts, } Client::Impl::~Impl() { - // Wrap up an insert if one is in progress. - EndInsert(); + try { + EndInsert(); + } catch (...) { + } } void Client::Impl::ExecuteQuery(Query query) {