25 #if defined(_MSC_VER) || defined(__BORLANDC__)
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)")
42 msg << function <<
": ";
45 msg <<
"\n " << file <<
"(" << line <<
"): \n";
52 std::string format(
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(file, line, function,
76 "Boost assertion failed: " +
81 char const * function,
char const * file,
83 throw std::runtime_error(format(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(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.
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)