Bitcoin Core  28.1.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 <node/warnings.h>
10 #include <util/signalinterrupt.h>
11 #include <util/translation.h>
12 
13 #include <atomic>
14 #include <cstdlib>
15 
16 namespace node {
17 
18 void AbortNode(util::SignalInterrupt* shutdown, std::atomic<int>& exit_status, const bilingual_str& message, node::Warnings* warnings)
19 {
20  if (warnings) warnings->Set(Warning::FATAL_INTERNAL_ERROR, message);
21  InitError(_("A fatal internal error occurred, see debug.log for details: ") + message);
22  exit_status.store(EXIT_FAILURE);
23  if (shutdown && !(*shutdown)()) {
24  LogError("Failed to send shutdown signal\n");
25  };
26 }
27 } // namespace node
Bilingual messages:
Definition: translation.h:18
Manages warning messages within a node.
Definition: warnings.h:39
void AbortNode(util::SignalInterrupt *shutdown, std::atomic< int > &exit_status, const bilingual_str &message, node::Warnings *warnings)
Definition: abort.cpp:18
bool Set(warning_type id, bilingual_str message) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Set a warning message.
Definition: warnings.cpp:29
bool InitError(const bilingual_str &str)
Show error message.
Definition: messages.h:20
Helper class that manages an interrupt flag, and allows a thread or signal to interrupt another threa...
#define LogError(...)
Definition: logging.h:271
int exit_status
bilingual_str _(ConstevalStringLiteral str)
Translation function.
Definition: translation.h:80