18 string str_file(file);
19 err =
"ERROR: " + str_file +
", line " +
std::to_string(line) +
": " + err;
20 throw std::runtime_error(err);
24 string str_file(file);
25 err =
"ERROR: " + str_file +
", line " +
std::to_string(line) +
": " + err;
26 throw std::invalid_argument(err);
30 string str_file(file);
31 err =
"ERROR: " + str_file +
", line " +
std::to_string(line) +
": " + err;
32 throw std::length_error(err);
35 void Warn(
string err,
const char *file,
int line )
37 string str_file(file);
38 err =
"WARNING: " + str_file +
", line " +
std::to_string(line) +
": " + err;
39 std::cout << err <<
"\n";
void my_handler(int s)
handle signals (ctr-c etc.)
void ThrowInvalidArgument(string err, const char *file, int line)
void ThrowRuntimeError(string err, const char *file, int line)
prints error and throws an exception
void ThrowLengthError(string err, const char *file, int line)
void Warn(string err, const char *file, int line)
prints error to stderr and returns
std::string to_string(const T &value)
template function to convert objects to string for logging