mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 03:12:43 +00:00
Fix NASTY C++ PITFALL: Function try blocks implicitly rethrow the exception
https://stackoverflow.com/a/5612508 Function try blocks silently rethrow the exception in ctors/dtors, even with "catch(...){}". Changed to standard try/catch. Now also logging exceptions.
This commit is contained in:
parent
0dda4921ba
commit
4bdab0d5e8
@ -177,8 +177,9 @@ QueryResultCache::Writer::Writer(std::mutex & mutex_, Cache & cache_, const Key
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryResultCache::Writer::~Writer()
|
QueryResultCache::Writer::~Writer()
|
||||||
try
|
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
if (skip_insert)
|
if (skip_insert)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -238,9 +239,11 @@ try
|
|||||||
|
|
||||||
LOG_DEBUG(&Poco::Logger::get("QueryResultCache"), "Stored result of query {}", key.queryStringFromAst());
|
LOG_DEBUG(&Poco::Logger::get("QueryResultCache"), "Stored result of query {}", key.queryStringFromAst());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const std::exception &)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
tryLogCurrentException(&Poco::Logger::get("QueryResultCache"), __PRETTY_FUNCTION__);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueryResultCache::Writer::buffer(Chunk && partial_query_result)
|
void QueryResultCache::Writer::buffer(Chunk && partial_query_result)
|
||||||
|
Loading…
Reference in New Issue
Block a user