mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 18:53:23 -03:00
util: Add StrFormatInternalBug and STR_INTERNAL_BUG
This commit is contained in:
parent
bcee94d107
commit
c6e7f224c1
2 changed files with 9 additions and 2 deletions
|
@ -14,10 +14,13 @@
|
|||
#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)\nPlease report this issue here: %s\n", msg, file, line, func, PACKAGE_BUGREPORT);
|
||||
}
|
||||
|
||||
NonFatalCheckError::NonFatalCheckError(const char* msg, const char* file, int line, const char* func)
|
||||
: std::runtime_error{
|
||||
strprintf("Internal bug detected: \"%s\"\n%s:%d (%s)\nPlease report this issue here: %s\n", msg, file, line, func, PACKAGE_BUGREPORT)}
|
||||
: std::runtime_error{StrFormatInternalBug(msg, file, line, func)}
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -10,12 +10,16 @@
|
|||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
std::string StrFormatInternalBug(const char* msg, const char* file, int line, const char* func);
|
||||
|
||||
class NonFatalCheckError : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
NonFatalCheckError(const char* msg, const char* file, int line, const char* func);
|
||||
};
|
||||
|
||||
#define STR_INTERNAL_BUG(msg) StrFormatInternalBug((msg), __FILE__, __LINE__, __func__)
|
||||
|
||||
/** Helper for CHECK_NONFATAL() */
|
||||
template <typename T>
|
||||
T&& inline_check_non_fatal(LIFETIMEBOUND T&& val, const char* file, int line, const char* func, const char* assertion)
|
||||
|
|
Loading…
Add table
Reference in a new issue