Set up macros for easier exception throwing.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-08-17 12:02:42 +02:00
parent a64c2aaca8
commit a665ad3eaf
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 10 additions and 1 deletions

View File

@ -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