27 std::string format_error(
29 const std::string& file,
long line,
31 const std::string&,
long,
33 #ifdef QL_ERROR_FUNCTIONS
34 const std::string& function,
38 const std::string& message) {
39 std::ostringstream msg;
40 #ifdef QL_ERROR_FUNCTIONS
41 if (function !=
"(unknown)")
45 msg <<
"\n " << file <<
"(" << line <<
"): \n";
52 std::string format_error(
const std::string& file,
long line,
53 const std::string& function,
54 const std::string& message) {
55 std::ostringstream msg;
57 msg <<
"\n" << file <<
":" << line <<
": ";
59 #ifdef QL_ERROR_FUNCTIONS
60 if (function !=
"(unknown)")
61 msg <<
"In function `" <<
function <<
"': \n";
74 char const * file,
long line) {
75 throw std::runtime_error(format_error(file, line, function,
76 "Boost assertion failed: " +
81 char const * function,
char const * file,
83 throw std::runtime_error(format_error(file, line, function,
84 "Boost assertion failed: " +
85 std::string(expr) +
": " +
94 const std::string& function,
95 const std::string& message) {
96 message_ = ext::make_shared<std::string>(
97 format_error(file, line, function, message));
ext::shared_ptr< std::string > message_
Error(const std::string &file, long line, const std::string &functionName, const std::string &message="")
const char * what() const noexcept override
returns the error message.
Classes and functions for error handling.
std::function< Ts... > function
void assertion_failed_msg(char const *expr, char const *msg, char const *function, char const *file, long line)
void assertion_failed(char const *expr, char const *function, char const *file, long line)