Skip to content

Commit c8f469c

Browse files
committed
external_signer: remove ExternalSignerException
It's not clear why this need it's own exception class, as opposed to just throwing std::runtime_error().
1 parent 9e0b199 commit c8f469c

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

src/external_signer.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <util/system.h>
1010
#include <external_signer.h>
1111

12+
#include <stdexcept>
1213
#include <string>
1314
#include <vector>
1415

@@ -26,21 +27,21 @@ bool ExternalSigner::Enumerate(const std::string& command, std::vector<ExternalS
2627
// Call <command> enumerate
2728
const UniValue result = RunCommandParseJSON(command + " enumerate");
2829
if (!result.isArray()) {
29-
throw ExternalSignerException(strprintf("'%s' received invalid response, expected array of signers", command));
30+
throw std::runtime_error(strprintf("'%s' received invalid response, expected array of signers", command));
3031
}
3132
for (UniValue signer : result.getValues()) {
3233
// Check for error
3334
const UniValue& error = find_value(signer, "error");
3435
if (!error.isNull()) {
3536
if (!error.isStr()) {
36-
throw ExternalSignerException(strprintf("'%s' error", command));
37+
throw std::runtime_error(strprintf("'%s' error", command));
3738
}
38-
throw ExternalSignerException(strprintf("'%s' error: %s", command, error.getValStr()));
39+
throw std::runtime_error(strprintf("'%s' error: %s", command, error.getValStr()));
3940
}
4041
// Check if fingerprint is present
4142
const UniValue& fingerprint = find_value(signer, "fingerprint");
4243
if (fingerprint.isNull()) {
43-
throw ExternalSignerException(strprintf("'%s' received invalid response, missing signer fingerprint", command));
44+
throw std::runtime_error(strprintf("'%s' received invalid response, missing signer fingerprint", command));
4445
}
4546
const std::string fingerprintStr = fingerprint.get_str();
4647
// Skip duplicate signer

src/external_signer.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,13 @@
88
#include <univalue.h>
99
#include <util/system.h>
1010

11-
#include <stdexcept>
1211
#include <string>
1312
#include <vector>
1413

1514
#ifdef ENABLE_EXTERNAL_SIGNER
1615

1716
struct PartiallySignedTransaction;
1817

19-
class ExternalSignerException : public std::runtime_error {
20-
public:
21-
using std::runtime_error::runtime_error;
22-
};
23-
2418
//! Enables interaction with an external signing device or service, such as
2519
//! a hardware wallet. See doc/external-signer.md
2620
class ExternalSigner

src/rpc/external_signer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static RPCHelpMan enumeratesigners()
4949
signer_res.pushKV("name", signer.m_name);
5050
signers_res.push_back(signer_res);
5151
}
52-
} catch (const ExternalSignerException& e) {
52+
} catch (const std::exception& e) {
5353
throw JSONRPCError(RPC_MISC_ERROR, e.what());
5454
}
5555
UniValue result(UniValue::VOBJ);

0 commit comments

Comments
 (0)