aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-04-13 19:55:59 +0800
committerfanquake <fanquake@gmail.com>2021-04-13 20:09:34 +0800
commitc8f469c6d50a8db6d92f0aed47a5d1cc82f30f7f (patch)
tree1a837e6e83ada96dfff569be2a6c31c38c80eeca
parent9e0b199b976617edeb1c58d4203df5f83a26c1e3 (diff)
downloadbitcoin-c8f469c6d50a8db6d92f0aed47a5d1cc82f30f7f.tar.xz
external_signer: remove ExternalSignerException
It's not clear why this need it's own exception class, as opposed to just throwing std::runtime_error().
-rw-r--r--src/external_signer.cpp9
-rw-r--r--src/external_signer.h6
-rw-r--r--src/rpc/external_signer.cpp2
3 files changed, 6 insertions, 11 deletions
diff --git a/src/external_signer.cpp b/src/external_signer.cpp
index 9325daeab2..f16d21fa60 100644
--- a/src/external_signer.cpp
+++ b/src/external_signer.cpp
@@ -9,6 +9,7 @@
#include <util/system.h>
#include <external_signer.h>
+#include <stdexcept>
#include <string>
#include <vector>
@@ -26,21 +27,21 @@ bool ExternalSigner::Enumerate(const std::string& command, std::vector<ExternalS
// Call <command> enumerate
const UniValue result = RunCommandParseJSON(command + " enumerate");
if (!result.isArray()) {
- throw ExternalSignerException(strprintf("'%s' received invalid response, expected array of signers", command));
+ throw std::runtime_error(strprintf("'%s' received invalid response, expected array of signers", command));
}
for (UniValue signer : result.getValues()) {
// Check for error
const UniValue& error = find_value(signer, "error");
if (!error.isNull()) {
if (!error.isStr()) {
- throw ExternalSignerException(strprintf("'%s' error", command));
+ throw std::runtime_error(strprintf("'%s' error", command));
}
- throw ExternalSignerException(strprintf("'%s' error: %s", command, error.getValStr()));
+ throw std::runtime_error(strprintf("'%s' error: %s", command, error.getValStr()));
}
// Check if fingerprint is present
const UniValue& fingerprint = find_value(signer, "fingerprint");
if (fingerprint.isNull()) {
- throw ExternalSignerException(strprintf("'%s' received invalid response, missing signer fingerprint", command));
+ throw std::runtime_error(strprintf("'%s' received invalid response, missing signer fingerprint", command));
}
const std::string fingerprintStr = fingerprint.get_str();
// Skip duplicate signer
diff --git a/src/external_signer.h b/src/external_signer.h
index 798662672e..b3b202091a 100644
--- a/src/external_signer.h
+++ b/src/external_signer.h
@@ -8,7 +8,6 @@
#include <univalue.h>
#include <util/system.h>
-#include <stdexcept>
#include <string>
#include <vector>
@@ -16,11 +15,6 @@
struct PartiallySignedTransaction;
-class ExternalSignerException : public std::runtime_error {
-public:
- using std::runtime_error::runtime_error;
-};
-
//! Enables interaction with an external signing device or service, such as
//! a hardware wallet. See doc/external-signer.md
class ExternalSigner
diff --git a/src/rpc/external_signer.cpp b/src/rpc/external_signer.cpp
index 08aa8d8dcb..6ec2b1a07f 100644
--- a/src/rpc/external_signer.cpp
+++ b/src/rpc/external_signer.cpp
@@ -49,7 +49,7 @@ static RPCHelpMan enumeratesigners()
signer_res.pushKV("name", signer.m_name);
signers_res.push_back(signer_res);
}
- } catch (const ExternalSignerException& e) {
+ } catch (const std::exception& e) {
throw JSONRPCError(RPC_MISC_ERROR, e.what());
}
UniValue result(UniValue::VOBJ);