aboutsummaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
authorTheCharlatan <seb.kung@gmail.com>2023-05-09 11:15:46 +0200
committerTheCharlatan <seb.kung@gmail.com>2023-06-28 09:52:33 +0200
commit6eb33bd0c21b3e075fbab596351cacafdc947472 (patch)
tree70c9082689cd178c864faa39bec9b02ea1ac028b /src/kernel
parent7320db96f8d2aeff0bc5dc67d8b7b37f5f808990 (diff)
downloadbitcoin-6eb33bd0c21b3e075fbab596351cacafdc947472.tar.xz
kernel: Add fatalError method to notifications
FatalError replaces what previously was the AbortNode function in shutdown.cpp. This commit is part of the libbitcoinkernel project and further removes the shutdown's and, more generally, the kernel library's dependency on interface_ui with a kernel notification method. By removing interface_ui from the kernel library, its dependency on boost is reduced to just boost::multi_index. At the same time it also takes a step towards de-globalising the interrupt infrastructure. Co-authored-by: Russell Yanofsky <russ@yanofsky.org> Co-authored-by: TheCharlatan <seb.kung@gmail.com>
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/notifications_interface.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/kernel/notifications_interface.h b/src/kernel/notifications_interface.h
index e009810473..e596a144a8 100644
--- a/src/kernel/notifications_interface.h
+++ b/src/kernel/notifications_interface.h
@@ -5,12 +5,13 @@
#ifndef BITCOIN_KERNEL_NOTIFICATIONS_INTERFACE_H
#define BITCOIN_KERNEL_NOTIFICATIONS_INTERFACE_H
+#include <util/translation.h>
+
#include <cstdint>
#include <string>
class CBlockIndex;
enum class SynchronizationState;
-struct bilingual_str;
namespace kernel {
@@ -35,6 +36,15 @@ public:
//! by logging the error, or notifying the user, or triggering an early
//! shutdown as a precaution against causing more errors.
virtual void flushError(const std::string& debug_message) {}
+
+ //! The fatal error notification is sent to notify the user when an error
+ //! occurs in kernel code that can't be recovered from. After this
+ //! notification is sent, whatever function triggered the error should also
+ //! return an error code or raise an exception. Applications can choose to
+ //! handle the fatal error notification by logging the error, or notifying
+ //! the user, or triggering an early shutdown as a precaution against
+ //! causing more errors.
+ virtual void fatalError(const std::string& debug_message, const bilingual_str& user_message = {}) {}
};
} // namespace kernel