Skip to content

Commit

Permalink
Merge branch 'cheshire-cat'
Browse files Browse the repository at this point in the history
* cheshire-cat:
  MB-46592: Catch exceptions that may occur inside logExecutionException

Change-Id: I42d953d05555973962f2b4729ef457e4abf08174
  • Loading branch information
BenHuddleston committed Jun 11, 2021
2 parents 8fb230e + 8c0304c commit cccbbd5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions daemon/connection.cc
Expand Up @@ -674,13 +674,15 @@ void Connection::logExecutionException(const std::string_view where,
e.what(),
array.dump());
}
} catch (const std::bad_alloc&) {
} catch (const std::exception& exception2) {
try {
LOG_ERROR(
"{}: Exception occurred during {}. Closing connection: {}",
"{}: Second exception occurred during {}. Closing "
"connection: e:{} exception2:{}",
getId(),
where,
e.what());
e.what(),
exception2.what());
if (const auto* backtrace = cb::getBacktrace(e)) {
LOG_ERROR("{}: Exception thrown from:", getId());
print_backtrace_frames(*backtrace, [this](const char* frame) {
Expand All @@ -690,6 +692,8 @@ void Connection::logExecutionException(const std::string_view where,
} catch (const std::bad_alloc&) {
// Logging failed.
}
} catch (...) {
// catch all, defensive as possible
}
}

Expand Down

0 comments on commit cccbbd5

Please sign in to comment.