Skip to content

Commit b81f971

Browse files
committed
Merge pull request #3749
4423571 Replace PrintException with PrintExceptionContinue + throw (Wladimir J. van der Laan)
2 parents ae7e5d7 + 4423571 commit b81f971

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

src/rpcclient.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ int CommandLineRPC(int argc, char *argv[])
236236
nRet = abs(RPC_MISC_ERROR);
237237
}
238238
catch (...) {
239-
PrintException(NULL, "CommandLineRPC()");
239+
PrintExceptionContinue(NULL, "CommandLineRPC()");
240+
throw;
240241
}
241242

242243
if (strPrint != "")

src/util.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -948,15 +948,6 @@ void LogException(std::exception* pex, const char* pszThread)
948948
LogPrintf("\n%s", message);
949949
}
950950

951-
void PrintException(std::exception* pex, const char* pszThread)
952-
{
953-
std::string message = FormatException(pex, pszThread);
954-
LogPrintf("\n\n************************\n%s\n", message);
955-
fprintf(stderr, "\n\n************************\n%s\n", message.c_str());
956-
strMiscWarning = message;
957-
throw;
958-
}
959-
960951
void PrintExceptionContinue(std::exception* pex, const char* pszThread)
961952
{
962953
std::string message = FormatException(pex, pszThread);

src/util.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ static inline bool error(const char* format)
164164

165165

166166
void LogException(std::exception* pex, const char* pszThread);
167-
void PrintException(std::exception* pex, const char* pszThread);
168167
void PrintExceptionContinue(std::exception* pex, const char* pszThread);
169168
void ParseString(const std::string& str, char c, std::vector<std::string>& v);
170169
std::string FormatMoney(int64_t n, bool fPlus=false);
@@ -558,10 +557,12 @@ template <typename Callable> void LoopForever(const char* name, Callable func,
558557
throw;
559558
}
560559
catch (std::exception& e) {
561-
PrintException(&e, name);
560+
PrintExceptionContinue(&e, name);
561+
throw;
562562
}
563563
catch (...) {
564-
PrintException(NULL, name);
564+
PrintExceptionContinue(NULL, name);
565+
throw;
565566
}
566567
}
567568
// .. and a wrapper that just calls func once
@@ -581,10 +582,12 @@ template <typename Callable> void TraceThread(const char* name, Callable func)
581582
throw;
582583
}
583584
catch (std::exception& e) {
584-
PrintException(&e, name);
585+
PrintExceptionContinue(&e, name);
586+
throw;
585587
}
586588
catch (...) {
587-
PrintException(NULL, name);
589+
PrintExceptionContinue(NULL, name);
590+
throw;
588591
}
589592
}
590593

0 commit comments

Comments
 (0)