2 #include <msp/debug/demangle.h>
3 #include <msp/strings/format.h>
11 data_error::data_error(const string &s, unsigned l, const string &w):
12 runtime_error(make_what(s, l, w)),
17 data_error::data_error(const string &s, unsigned l, const exception &e):
18 runtime_error(make_what(s, l, format("%s (%s)", Debug::demangle(typeid(e).name()), e.what()))),
23 string data_error::make_what(const string &s, unsigned l, const string &w)
26 return format("%s:%d: %s", s, l, w);
28 return format("%s: %s", s, w);
32 parse_error::parse_error(const string &t):
33 runtime_error(t.empty() ? "at end of input" : format("after '%s'", t))
37 syntax_error::syntax_error(const string &t):
38 runtime_error(t.empty() ? "at end of input" : format("at '%s'", t))
42 bad_definition::bad_definition(const string &w):
47 nesting_error::nesting_error(const string &w):
51 } // namespace DataFile