Skip to content

Commit 7440754

Browse files
committed
f BDK: Account for split error types
1 parent 2ff8287 commit 7440754

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)]
@@ -181,12 +185,21 @@ impl fmt::Display for Error {
181185

182186
impl std::error::Error for Error {}
183187

184-
impl From<bdk::Error> for Error {
185-
fn from(e: bdk::Error) -> Self {
186-
match e {
187-
bdk::Error::Signer(_) => Self::OnchainTxSigningFailed,
188-
_ => Self::WalletOperationFailed,
189-
}
188+
impl From<BdkSignerError> for Error {
189+
fn from(_: BdkSignerError) -> Self {
190+
Self::OnchainTxSigningFailed
191+
}
192+
}
193+
194+
impl From<BdkCreateTxError> for Error {
195+
fn from(_: BdkCreateTxError) -> Self {
196+
Self::OnchainTxCreationFailed
197+
}
198+
}
199+
200+
impl From<BdkExtractTxError> for Error {
201+
fn from(_: BdkExtractTxError) -> Self {
202+
Self::OnchainTxCreationFailed
190203
}
191204
}
192205

0 commit comments

Comments
 (0)