Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2009-2010 Satoshi Nakamoto2// Copyright (c) 2009-present The Bitcoin Core developers3// Distributed under the MIT software license, see the accompanying4// file COPYING or http://www.opensource.org/licenses/mit-license.php.6#include <util/exception.h>8#include <tinyformat.h>9#include <util/log.h>11#include <exception>12#include <iostream>13#include <string>14#include <typeinfo>16#ifdef WIN3217#include <windows.h>18#endif // WIN3220static std::string FormatException(const std::exception* pex, std::string_view thread_name)21{22#ifdef WIN3223char pszModule[MAX_PATH] = "";24GetModuleFileNameA(nullptr, pszModule, sizeof(pszModule));25#else26const char* pszModule = "bitcoin";27#endif28if (pex)29return strprintf(30"EXCEPTION: %s \n%s \n%s in %s \n", typeid(*pex).name(), pex->what(), pszModule, thread_name);31else32return strprintf(33"UNKNOWN EXCEPTION \n%s in %s \n", pszModule, thread_name);34}36void PrintExceptionContinue(const std::exception* pex, std::string_view thread_name)37{38std::string message = FormatException(pex, thread_name);39LogWarning("\n\n************************\n%s", message);40tfm::format(std::cerr, "\n\n************************\n%s\n", message);41}