77 return _stack.top().c_str();
104 status(
"%s%s", prefix.
c_str(), stack.top().c_str());
108 while (!stack.empty()) {
109 status(
" Because: %s", stack.top().c_str());
113 status(
"FATAL ERROR: Exception while printing exception stack");
127 }
catch (std::exception &e) {
130 se.
add(
"%s", reason);
134 if (reason[0] != 0) {
void add(const char *s,...) GCC_PRINTF(2
static void exceptionDispatcher(const char *prefix, const char *reason="")
A class holding an UTF-8 string.
Exception that provides a stack of explanations.
void exceptionDispatcherWarning(const char *s,...)
Exception dispatcher that prints the exception as a warning, and adds another reason on top...
std::stack< UString > Stack
Basic exceptions to throw.
const char * c_str() const
Return the (utf8 encoded) string data.
Utility templates and functions.
const Exception kWriteError("Write error")
Exception when writing to a stream failed.
const Exception kReadError("Read error")
Exception when reading from a stream failed.
void exceptionDispatcherError(const char *s,...)
Exception dispatcher that prints the exception as an error, and adds another reason on top...
const Exception kSeekError("Seek error")
Exception when seeking a stream failed.
void status(const char *s,...)
const Exception kOpenError("Can't open file")
Exception when a file couldn't be opened.
const char * what() const
void printException(Exception &e, const UString &prefix)
Print a whole exception stack to stderr and the log.