X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdataerror.cpp;fp=source%2Fdataerror.cpp;h=b21b84fca459a59d2c785564e64bcf1a35cf499e;hb=d14b7ddd81404b909a4c4763a36a23b94998a089;hp=0000000000000000000000000000000000000000;hpb=67146b1b3bcb7d02307dcd4cc8b88cf778b41205;p=libs%2Fdatafile.git diff --git a/source/dataerror.cpp b/source/dataerror.cpp new file mode 100644 index 0000000..b21b84f --- /dev/null +++ b/source/dataerror.cpp @@ -0,0 +1,32 @@ +#include +#include +#include +#include "dataerror.h" + +using namespace std; + +namespace Msp { +namespace DataFile { + +data_error::data_error(const string &s, unsigned l, const string &w): + runtime_error(make_what(s, l, w)), + source(s), + line(l) +{ } + +data_error::data_error(const string &s, unsigned l, const exception &e): + runtime_error(make_what(s, l, format("%s (%s)", Debug::demangle(typeid(e).name()), e.what()))), + source(s), + line(l) +{ } + +string data_error::make_what(const string &s, unsigned l, const string &w) +{ + if(l) + return format("%s:%d: %s", s, l, w); + else + return format("%s: %s", s, w); +} + +} // namespace DataFile +} // namespace Msp