Set up macros for easier exception throwing.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
a64c2aaca8
commit
a665ad3eaf
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue