Skip to content

Commit d314293

Browse files
committed
refactor Unsupported error to take rpc & arg
1 parent e51c69c commit d314293

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

client/src/client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub trait RpcApi: Sized {
290290
if self.version()? < 210000 {
291291
// note: we allow Some(false) since it's the default behavior
292292
if let Some(true) = descriptors {
293-
return Err(Error::Unsupported);
293+
return Err(Error::UnsupportedArgument("createwallet", "descriptors"));
294294
}
295295
// no descriptors argument yet
296296
let mut args = [

client/src/error.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ pub enum Error {
3131
UnexpectedStructure,
3232
/// The daemon returned an error string.
3333
ReturnedError(String),
34-
/// Feature not supported by the connected bitcoin version.
35-
Unsupported,
34+
/// The {0} RPC does not support the {1} argument on the connected bitcoin version.
35+
UnsupportedArgument(&'static str, &'static str),
3636
}
3737

3838
impl From<jsonrpc::error::Error> for Error {
@@ -90,8 +90,8 @@ impl fmt::Display for Error {
9090
Error::InvalidCookieFile => write!(f, "invalid cookie file"),
9191
Error::UnexpectedStructure => write!(f, "the JSON result had an unexpected structure"),
9292
Error::ReturnedError(ref s) => write!(f, "the daemon returned an error string: {}", s),
93-
Error::Unsupported => {
94-
write!(f, "the daemon version does not support the accessed feature")
93+
Error::UnsupportedArgument(rpc, arg) => {
94+
write!(f, "the daemon version does not support the {} argument for {}", arg, rpc)
9595
}
9696
}
9797
}

0 commit comments

Comments
 (0)