From 642e21e8e1e33823860bfeebdb1896e75daaf72c Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov Date: Thu, 20 Feb 2020 15:29:53 +0300 Subject: [PATCH] Log error message before aborting on LOGICAL_ERROR. --- dbms/src/Common/Exception.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dbms/src/Common/Exception.cpp b/dbms/src/Common/Exception.cpp index 318da1a27f2..3e46d130266 100644 --- a/dbms/src/Common/Exception.cpp +++ b/dbms/src/Common/Exception.cpp @@ -35,7 +35,14 @@ Exception::Exception(const std::string & msg, int code) : Poco::Exception(msg, code) { // In debug builds, treat LOGICAL_ERROR as an assertion failure. - assert(code != ErrorCodes::LOGICAL_ERROR); + // Log the message before we fail. +#ifndef NDEBUG + if (code == ErrorCodes::LOGICAL_ERROR) + { + LOG_ERROR(&Poco::Logger::root(), "Logical error: '" + msg + "'."); + assert(false); + } +#endif } Exception::Exception(CreateFromPocoTag, const Poco::Exception & exc)