Skip to content

Commit

Permalink
add exception info to crashlogger
Browse files Browse the repository at this point in the history
  • Loading branch information
Try committed Oct 14, 2019
1 parent 2ed392f commit 7cc7c05
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Game/utils/crashlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,28 @@ static void signalHandler(int sig) {

[[noreturn]]
static void terminateHandler() {
CrashLog::dumpStack("std::terminate");
char msg[128] = "std::terminate";
std::exception_ptr p = std::current_exception();
if(p) {
try {
std::rethrow_exception(p);
}
catch (std::system_error& e) {
std::snprintf(msg,sizeof(msg),"std::system_error(%s)",e.what());
}
catch (std::runtime_error& e) {
std::snprintf(msg,sizeof(msg),"std::runtime_error(%s)",e.what());
}
catch (std::logic_error& e) {
std::snprintf(msg,sizeof(msg),"std::logic_error(%s)",e.what());
}
catch (std::bad_alloc& e) {
std::snprintf(msg,sizeof(msg),"std::bad_alloc(%s)",e.what());
}
catch (...) {
}
}
CrashLog::dumpStack(msg);
std::abort();
}

Expand Down

0 comments on commit 7cc7c05

Please sign in to comment.