Merge pull request #4331 from sfc-gh-anoyes/anoyes/std-exception
Log std::exception::what when creating an unknown_error
This commit is contained in:
commit
6b1b127ee1
|
@ -57,13 +57,25 @@ Error internal_error_impl( const char* file, int line ) {
|
|||
return Error(error_code_internal_error);
|
||||
}
|
||||
|
||||
Error::Error(int error_code)
|
||||
: error_code(error_code), flags(0)
|
||||
{
|
||||
Error::Error(int error_code) : error_code(error_code), flags(0) {
|
||||
if (TRACE_SAMPLE()) TraceEvent(SevSample, "ErrorCreated").detail("ErrorCode", error_code);
|
||||
// std::cout << "Error: " << error_code << std::endl;
|
||||
if (error_code >= 3000 && error_code < 6000) {
|
||||
TraceEvent(SevError, "SystemError").error(*this).backtrace();
|
||||
{
|
||||
TraceEvent te(SevError, "SystemError");
|
||||
te.error(*this).backtrace();
|
||||
if (error_code == error_code_unknown_error) {
|
||||
auto exception = std::current_exception();
|
||||
if (exception) {
|
||||
try {
|
||||
std::rethrow_exception(exception);
|
||||
} catch (std::exception& e) {
|
||||
te.detail("StdException", e.what());
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (g_crashOnError) {
|
||||
flushOutputStreams();
|
||||
flushTraceFileVoid();
|
||||
|
|
Loading…
Reference in New Issue