aboutsummaryrefslogtreecommitdiff
path: root/src/util/check.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/check.cpp')
-rw-r--r--src/util/check.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/util/check.cpp b/src/util/check.cpp
index 2a9f885560..34b9d376a7 100644
--- a/src/util/check.cpp
+++ b/src/util/check.cpp
@@ -4,8 +4,30 @@
#include <util/check.h>
+#if defined(HAVE_CONFIG_H)
+#include <config/bitcoin-config.h>
+#endif
+
+#include <clientversion.h>
#include <tinyformat.h>
+#include <cstdio>
+#include <cstdlib>
+#include <string>
+
+std::string StrFormatInternalBug(const char* msg, const char* file, int line, const char* func)
+{
+ return strprintf("Internal bug detected: \"%s\"\n%s:%d (%s)\n"
+ "%s %s\n"
+ "Please report this issue here: %s\n",
+ msg, file, line, func, PACKAGE_NAME, FormatFullVersion(), PACKAGE_BUGREPORT);
+}
+
+NonFatalCheckError::NonFatalCheckError(const char* msg, const char* file, int line, const char* func)
+ : std::runtime_error{StrFormatInternalBug(msg, file, line, func)}
+{
+}
+
void assertion_fail(const char* file, int line, const char* func, const char* assertion)
{
auto str = strprintf("%s:%s %s: Assertion `%s' failed.\n", file, line, func, assertion);