From 431ecbf886b6adc2293c5bf62988c7123156f488 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 2 Aug 2020 16:46:50 +0300 Subject: [PATCH 1/2] Print exception origin in crash messages We use `PrintExceptionContinue` in many places and we pass crash origin to it as a param but we never use it. Also, change the param name to better match its meaning. --- src/util.cpp | 9 ++------- src/util.h | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index 53b25596cb56..626869f9f1e9 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -576,14 +576,9 @@ std::string HelpMessageOpt(const std::string &option, const std::string &message std::string("\n\n"); } -static std::string FormatException(const std::exception_ptr pex, const char* pszThread) +void PrintExceptionContinue(const std::exception_ptr pex, const char* pszExceptionOrigin) { - return GetPrettyExceptionStr(pex); -} - -void PrintExceptionContinue(const std::exception_ptr pex, const char* pszThread) -{ - std::string message = FormatException(pex, pszThread); + std::string message = strprintf("\"%s\" rised an exception\n%s", pszExceptionOrigin, GetPrettyExceptionStr(pex)); LogPrintf("\n\n************************\n%s\n", message); fprintf(stderr, "\n\n************************\n%s\n", message.c_str()); } diff --git a/src/util.h b/src/util.h index d2282ab78fee..5dc45d4b7de0 100644 --- a/src/util.h +++ b/src/util.h @@ -90,7 +90,7 @@ bool error(const char* fmt, const Args&... args) return false; } -void PrintExceptionContinue(const std::exception_ptr pex, const char* pszThread); +void PrintExceptionContinue(const std::exception_ptr pex, const char* pszExceptionOrigin); void FileCommit(FILE *file); bool TruncateFile(FILE *file, unsigned int length); int RaiseFileDescriptorLimit(int nMinFD); From 0b494973c6b6f82a93e2bccc3c12e0a0ae695ca7 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 9 Aug 2020 19:29:27 +0300 Subject: [PATCH 2/2] Update src/util.cpp Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com> --- src/util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.cpp b/src/util.cpp index 626869f9f1e9..04093880bd0f 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -578,7 +578,7 @@ std::string HelpMessageOpt(const std::string &option, const std::string &message void PrintExceptionContinue(const std::exception_ptr pex, const char* pszExceptionOrigin) { - std::string message = strprintf("\"%s\" rised an exception\n%s", pszExceptionOrigin, GetPrettyExceptionStr(pex)); + std::string message = strprintf("\"%s\" raised an exception\n%s", pszExceptionOrigin, GetPrettyExceptionStr(pex)); LogPrintf("\n\n************************\n%s\n", message); fprintf(stderr, "\n\n************************\n%s\n", message.c_str()); }