![]() |
Bitcoin Core
21.99.0
P2P Digital Currency
|
Go to the source code of this file.
Classes | |
class | NonFatalCheckError |
Macros | |
#define | CHECK_NONFATAL(condition) |
Throw a NonFatalCheckError when the condition evaluates to false. More... | |
#define | Assert(val) ([&]() -> decltype(get_pure_r_value(val)) { auto&& check = (val); assert(#val && check); return std::forward<decltype(get_pure_r_value(val))>(check); }()) |
Identity function. More... | |
#define | Assume(val) ([&]() -> decltype(get_pure_r_value(val)) { auto&& check = (val); return std::forward<decltype(get_pure_r_value(val))>(check); }()) |
Assume is the identity function. More... | |
Functions | |
template<typename T > | |
T | get_pure_r_value (T &&val) |
Helper for Assert() More... | |
#define Assert | ( | val | ) | ([&]() -> decltype(get_pure_r_value(val)) { auto&& check = (val); assert(#val && check); return std::forward<decltype(get_pure_r_value(val))>(check); }()) |
#define Assume | ( | val | ) | ([&]() -> decltype(get_pure_r_value(val)) { auto&& check = (val); return std::forward<decltype(get_pure_r_value(val))>(check); }()) |
Assume is the identity function.
#define CHECK_NONFATAL | ( | condition | ) |
Throw a NonFatalCheckError when the condition evaluates to false.
This should only be used
For example in RPC code, where it is undesirable to crash the whole program, this can be generally used to replace asserts or recoverable logic errors. A NonFatalCheckError in RPC code is caught and passed as a string to the RPC caller, which can then report the issue to the developers.