Bitcoin Core  0.19.99
P2P Digital Currency
check.h
Go to the documentation of this file.
1 // Copyright (c) 2019 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 #ifndef BITCOIN_UTIL_CHECK_H
6 #define BITCOIN_UTIL_CHECK_H
7 
8 #include <tinyformat.h>
9 
10 #include <stdexcept>
11 
12 class NonFatalCheckError : public std::runtime_error
13 {
14  using std::runtime_error::runtime_error;
15 };
16 
28 #define CHECK_NONFATAL(condition) \
29  do { \
30  if (!(condition)) { \
31  throw NonFatalCheckError( \
32  strprintf("%s:%d (%s)\n" \
33  "Internal bug detected: '%s'\n" \
34  "You may report this issue here: %s\n", \
35  __FILE__, __LINE__, __func__, \
36  (#condition), \
37  PACKAGE_BUGREPORT)); \
38  } \
39  } while (false)
40 
41 #endif // BITCOIN_UTIL_CHECK_H