Hard-abort on assertion and show detailed information, solves #2579
From > [warn} oops to > [assert] /tmp/osrm-backend/src/extractor/extractor.cpp:79 > in: int osrm::extractor::Extractor::run(): false > terminate called without an active exception
This commit is contained in:
+7
-6
@@ -1,16 +1,17 @@
|
||||
#include "util/assert.hpp"
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <sstream>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
|
||||
namespace
|
||||
{
|
||||
// We throw to guarantee for stack-unwinding and therefore our destructors being called.
|
||||
// We hard-abort on assertion violations.
|
||||
void assertion_failed_msg_helper(
|
||||
char const *expr, char const *msg, char const *function, char const *file, long line)
|
||||
{
|
||||
std::ostringstream fmt;
|
||||
fmt << file << ":" << line << "\nin: " << function << ": " << expr << "\n" << msg;
|
||||
throw osrm::util::assertionError{fmt.str().c_str()};
|
||||
std::cerr << "[assert] " << file << ":" << line << "\nin: " << function << ": " << expr << "\n"
|
||||
<< msg;
|
||||
std::terminate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user