refactor: Use STR_INTERNAL_BUG macro where possible

This ensures a uniform bug template and allows to drop includes and
logic at the call sites.
This commit is contained in:
MarcoFalke
2025-11-06 14:21:14 +01:00
parent fada379589
commit fad6efd3be
2 changed files with 5 additions and 20 deletions

View File

@@ -2,10 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bitcoin-build-config.h> // IWYU pragma: keep
#include <chain.h>
#include <clientversion.h>
#include <common/args.h>
#include <common/messages.h>
#include <common/types.h>
@@ -678,10 +675,8 @@ UniValue RPCHelpMan::HandleRequest(const JSONRPCRequest& request) const
mismatch.size() == 1 ? mismatch[0].write(4) :
mismatch.write(4)};
throw std::runtime_error{
strprintf("Internal bug detected: RPC call \"%s\" returned incorrect type:\n%s\n%s %s\nPlease report this issue here: %s\n",
m_name, explain,
CLIENT_NAME, FormatFullVersion(),
CLIENT_BUGREPORT)};
STR_INTERNAL_BUG(strprintf("RPC call \"%s\" returned incorrect type:\n%s", m_name, explain)),
};
}
}
return ret;