mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-03 11:53:16 +02:00
util: Add StrFormatInternalBug and STR_INTERNAL_BUG
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user