// funcPtr != NULL ? *funcPtr : "");
// }
+ bool bAnythingWritten = false;
// TODO: Remove duplicate context if present in multiple nested exceptions.
const ErrorMessage *msg = boost::get_error_info<errinfo_message>(*boostEx);
if (msg != NULL)
if (msg != NULL && !msg->text().empty())
{
writer->writeLine(msg->text().c_str(), indent*2);
+ bAnythingWritten = true;
}
}
else
{
writer->writeLine(ex.what(), indent*2);
+ bAnythingWritten = true;
}
const int *errorNumber
writer->writeErrNoInfo(*errorNumber,
funcName != NULL ? *funcName : NULL,
(indent+1)*2);
+ bAnythingWritten = true;
}
// TODO: Treat also boost::nested_exception (not currently used, though)
}
catch (const std::exception &nestedEx)
{
- formatExceptionMessageInternal(writer, nestedEx, indent + 1);
+ const int newIndent = indent + (bAnythingWritten ? 1 : 0);
+ formatExceptionMessageInternal(writer, nestedEx, newIndent);
}
}
}