Merge pull request #9247 from ClickHouse/aku/logical-error-message

Log error message before aborting on LOGICAL_ERROR.
This commit is contained in:
alexey-milovidov 2020-02-20 21:45:01 +03:00 committed by GitHub
commit 5c097f842f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,7 +35,14 @@ Exception::Exception(const std::string & msg, int code)
: Poco::Exception(msg, code) : Poco::Exception(msg, code)
{ {
// In debug builds, treat LOGICAL_ERROR as an assertion failure. // 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) Exception::Exception(CreateFromPocoTag, const Poco::Exception & exc)