Print exception origin in crash messages (#3653)

* 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.

* Update src/util.cpp

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>

Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com>
This commit is contained in:
UdjinM6 2020-08-14 14:43:22 +03:00 committed by GitHub
parent e86b1ec7ed
commit 81e25e01e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View File

@ -576,14 +576,9 @@ std::string HelpMessageOpt(const std::string &option, const std::string &message
std::string("\n\n"); 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); std::string message = strprintf("\"%s\" raised an exception\n%s", pszExceptionOrigin, GetPrettyExceptionStr(pex));
}
void PrintExceptionContinue(const std::exception_ptr pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
LogPrintf("\n\n************************\n%s\n", message); LogPrintf("\n\n************************\n%s\n", message);
fprintf(stderr, "\n\n************************\n%s\n", message.c_str()); fprintf(stderr, "\n\n************************\n%s\n", message.c_str());
} }

View File

@ -90,7 +90,7 @@ bool error(const char* fmt, const Args&... args)
return false; 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); void FileCommit(FILE *file);
bool TruncateFile(FILE *file, unsigned int length); bool TruncateFile(FILE *file, unsigned int length);
int RaiseFileDescriptorLimit(int nMinFD); int RaiseFileDescriptorLimit(int nMinFD);