/Users/eugenesiegel/btc/bitcoin/src/util/exception.cpp
| Line | Count | Source (jump to first uncovered line) | 
| 1 |  | // Copyright (c) 2009-2010 Satoshi Nakamoto | 
| 2 |  | // Copyright (c) 2009-2023 The Bitcoin Core developers | 
| 3 |  | // Distributed under the MIT software license, see the accompanying | 
| 4 |  | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | 
| 5 |  |  | 
| 6 |  | #include <util/exception.h> | 
| 7 |  |  | 
| 8 |  | #include <logging.h> | 
| 9 |  | #include <tinyformat.h> | 
| 10 |  |  | 
| 11 |  | #include <exception> | 
| 12 |  | #include <iostream> | 
| 13 |  | #include <string> | 
| 14 |  | #include <typeinfo> | 
| 15 |  |  | 
| 16 |  | #ifdef WIN32 | 
| 17 |  | #include <windows.h> | 
| 18 |  | #endif // WIN32 | 
| 19 |  |  | 
| 20 |  | static std::string FormatException(const std::exception* pex, std::string_view thread_name) | 
| 21 | 0 | { | 
| 22 |  | #ifdef WIN32 | 
| 23 |  |     char pszModule[MAX_PATH] = ""; | 
| 24 |  |     GetModuleFileNameA(nullptr, pszModule, sizeof(pszModule)); | 
| 25 |  | #else | 
| 26 | 0 |     const char* pszModule = "bitcoin"; | 
| 27 | 0 | #endif | 
| 28 | 0 |     if (pex) | 
| 29 | 0 |         return strprintf( | Line | Count | Source |  | 1172 | 0 | #define strprintf tfm::format | 
 | 
| 30 | 0 |             "EXCEPTION: %s       \n%s       \n%s in %s       \n", typeid(*pex).name(), pex->what(), pszModule, thread_name); | 
| 31 | 0 |     else | 
| 32 | 0 |         return strprintf( | Line | Count | Source |  | 1172 | 0 | #define strprintf tfm::format | 
 | 
| 33 | 0 |             "UNKNOWN EXCEPTION       \n%s in %s       \n", pszModule, thread_name); | 
| 34 | 0 | } | 
| 35 |  |  | 
| 36 |  | void PrintExceptionContinue(const std::exception* pex, std::string_view thread_name) | 
| 37 | 0 | { | 
| 38 | 0 |     std::string message = FormatException(pex, thread_name); | 
| 39 | 0 |     LogPrintf("\n\n************************\n%s\n", message);| Line | Count | Source |  | 361 | 0 | #define LogPrintf(...) LogInfo(__VA_ARGS__) | Line | Count | Source |  | 356 | 0 | #define LogInfo(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Info, /*should_ratelimit=*/true, __VA_ARGS__) | Line | Count | Source |  | 350 | 0 | #define LogPrintLevel_(category, level, should_ratelimit, ...) LogPrintFormatInternal(std::source_location::current(), category, level, should_ratelimit, __VA_ARGS__) | 
 | 
 | 
 | 
| 40 | 0 |     tfm::format(std::cerr, "\n\n************************\n%s\n", message); | 
| 41 | 0 | } |