Bitcoin Core  27.99.0
P2P Digital Currency
abort.cpp
Go to the documentation of this file.
1 // Copyright (c) 2023 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <node/abort.h>
6 
7 #include <logging.h>
8 #include <node/interface_ui.h>
9 #include <util/signalinterrupt.h>
10 #include <util/translation.h>
11 #include <warnings.h>
12 
13 #include <atomic>
14 #include <cstdlib>
15 #include <string>
16 
17 namespace node {
18 
19 void AbortNode(util::SignalInterrupt* shutdown, std::atomic<int>& exit_status, const bilingual_str& message)
20 {
21  SetMiscWarning(message);
22  InitError(_("A fatal internal error occurred, see debug.log for details: ") + message);
23  exit_status.store(EXIT_FAILURE);
24  if (shutdown && !(*shutdown)()) {
25  LogError("Failed to send shutdown signal\n");
26  };
27 }
28 } // namespace node
int exit_status
Helper class that manages an interrupt flag, and allows a thread or signal to interrupt another threa...
bool InitError(const bilingual_str &str)
Show error message.
#define LogError(...)
Definition: logging.h:241
Definition: init.h:25
void AbortNode(util::SignalInterrupt *shutdown, std::atomic< int > &exit_status, const bilingual_str &message)
Definition: abort.cpp:19
Bilingual messages:
Definition: translation.h:18
bilingual_str _(const char *psz)
Translation function.
Definition: translation.h:74
void SetMiscWarning(const bilingual_str &warning)
Definition: warnings.cpp:22