|
5 | 5 | #ifndef BITCOIN_UTIL_CHECK_H
|
6 | 6 | #define BITCOIN_UTIL_CHECK_H
|
7 | 7 |
|
8 |
| -#if defined(HAVE_CONFIG_H) |
9 |
| -#include <config/bitcoin-config.h> |
10 |
| -#endif |
11 |
| - |
12 | 8 | #include <attributes.h>
|
13 |
| -#include <tinyformat.h> |
14 | 9 |
|
15 | 10 | #include <stdexcept>
|
| 11 | +#include <utility> |
16 | 12 |
|
17 | 13 | class NonFatalCheckError : public std::runtime_error
|
18 | 14 | {
|
19 |
| - using std::runtime_error::runtime_error; |
| 15 | +public: |
| 16 | + NonFatalCheckError(const char* msg, const char* file, int line, const char* func); |
20 | 17 | };
|
21 | 18 |
|
22 |
| -#define format_internal_error(msg, file, line, func, report) \ |
23 |
| - strprintf("Internal bug detected: \"%s\"\n%s:%d (%s)\nPlease report this issue here: %s\n", \ |
24 |
| - msg, file, line, func, report) |
25 |
| - |
26 | 19 | /** Helper for CHECK_NONFATAL() */
|
27 | 20 | template <typename T>
|
28 | 21 | T&& inline_check_non_fatal(LIFETIMEBOUND T&& val, const char* file, int line, const char* func, const char* assertion)
|
29 | 22 | {
|
30 |
| - if (!(val)) { |
31 |
| - throw NonFatalCheckError( |
32 |
| - format_internal_error(assertion, file, line, func, PACKAGE_BUGREPORT)); |
| 23 | + if (!val) { |
| 24 | + throw NonFatalCheckError{assertion, file, line, func}; |
33 | 25 | }
|
34 | 26 | return std::forward<T>(val);
|
35 | 27 | }
|
@@ -88,11 +80,9 @@ T&& inline_assertion_check(LIFETIMEBOUND T&& val, [[maybe_unused]] const char* f
|
88 | 80 |
|
89 | 81 | /**
|
90 | 82 | * NONFATAL_UNREACHABLE() is a macro that is used to mark unreachable code. It throws a NonFatalCheckError.
|
91 |
| - * This is used to mark code that is not yet implemented or is not yet reachable. |
92 | 83 | */
|
93 | 84 | #define NONFATAL_UNREACHABLE() \
|
94 | 85 | throw NonFatalCheckError( \
|
95 |
| - format_internal_error("Unreachable code reached (non-fatal)", \ |
96 |
| - __FILE__, __LINE__, __func__, PACKAGE_BUGREPORT)) |
| 86 | + "Unreachable code reached (non-fatal)", __FILE__, __LINE__, __func__) |
97 | 87 |
|
98 | 88 | #endif // BITCOIN_UTIL_CHECK_H
|
0 commit comments