Skip to content

Commit

Permalink
COMMON: Catch exceptions thrown in printException()
Browse files Browse the repository at this point in the history
Inception...

Coverity issue 1038238 and 1038240, again.
  • Loading branch information
DrMcCoy committed Jun 25, 2013
1 parent b9ef84f commit 5d23c1f
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/common/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,22 @@ const Exception kWriteError("Write error");
void printException(Exception &e, const UString &prefix) {
Exception::Stack &stack = e.getStack();

if (stack.empty()) {
status("FATAL ERROR");
return;
}

status("%s%s", prefix.c_str(), stack.top().c_str());
try {
if (stack.empty()) {
status("FATAL ERROR");
return;
}

stack.pop();
status("%s%s", prefix.c_str(), stack.top().c_str());

while (!stack.empty()) {
status(" Because: %s", stack.top().c_str());
stack.pop();

while (!stack.empty()) {
status(" Because: %s", stack.top().c_str());
stack.pop();
}
} catch (...) {
status("FATAL ERROR: Exception while printing exception stack");
}
}

Expand Down

0 comments on commit 5d23c1f

Please sign in to comment.