Skip to content

Commit 03be78d

Browse files
committed
f BDK: Account for split error types
1 parent e7daa83 commit 03be78d

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/error.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
// http://opensource.org/licenses/MIT>, at your option. You may not use this file except in
66
// accordance with one or both of these licenses.
77

8+
use bdk_chain::bitcoin::psbt::ExtractTxError as BdkExtractTxError;
9+
use bdk_wallet::error::CreateTxError as BdkCreateTxError;
10+
use bdk_wallet::signer::SignerError as BdkSignerError;
11+
812
use std::fmt;
913

1014
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
@@ -184,12 +188,21 @@ impl fmt::Display for Error {
184188

185189
impl std::error::Error for Error {}
186190

187-
impl From<bdk::Error> for Error {
188-
fn from(e: bdk::Error) -> Self {
189-
match e {
190-
bdk::Error::Signer(_) => Self::OnchainTxSigningFailed,
191-
_ => Self::WalletOperationFailed,
192-
}
191+
impl From<BdkSignerError> for Error {
192+
fn from(_: BdkSignerError) -> Self {
193+
Self::OnchainTxSigningFailed
194+
}
195+
}
196+
197+
impl From<BdkCreateTxError> for Error {
198+
fn from(_: BdkCreateTxError) -> Self {
199+
Self::OnchainTxCreationFailed
200+
}
201+
}
202+
203+
impl From<BdkExtractTxError> for Error {
204+
fn from(_: BdkExtractTxError) -> Self {
205+
Self::OnchainTxCreationFailed
193206
}
194207
}
195208

0 commit comments

Comments
 (0)