diff --git a/src/Exception.hpp b/src/Exception.hpp index 8f7e910..5562f00 100644 --- a/src/Exception.hpp +++ b/src/Exception.hpp @@ -109,7 +109,7 @@ namespace ArbUt { p = snippet.find_last_not_of(" \t"); if (std::string::npos != p) - snippet.erase(p+1); + snippet.erase(p + 1); if (snippet.length() > 70) { snippet = snippet.substr(0, 67); snippet += "..."; @@ -121,4 +121,13 @@ namespace ArbUt { }; } +#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) + +#define THROW(message) \ + std::stringstream ___ss; \ + ___ss << "[" << __FILENAME__ << ":" << __LINE__ << "] " << message; \ + throw ArbUt::Exception(___ss.str()); +#define NOT_REACHABLE THROW("Not reachable"); +#define NOT_IMPLEMENTED THROW("Not implemented"); + #endif // ARBUTILS_EXCEPTION_HPP