Skip to content

Commit 3045bea

Browse files
authored
Merge pull request zingolabs#1474 from fluidvanadium/thaterror
Explicit Invocation of thiserror::Error macro
2 parents a041ae1 + d88207e commit 3045bea

File tree

8 files changed

+17
-26
lines changed

8 files changed

+17
-26
lines changed

zingo-netutils/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use client::client_from_connector;
1010
use http::{uri::PathAndQuery, Uri};
1111
use http_body_util::combinators::UnsyncBoxBody;
1212
use hyper_util::client::legacy::connect::HttpConnector;
13-
use thiserror::Error;
1413
use tokio_rustls::rustls::pki_types::{Der, TrustAnchor};
1514
use tokio_rustls::rustls::{ClientConfig, RootCertStore};
1615
use tonic::Status;
@@ -26,7 +25,7 @@ pub type UnderlyingService = BoxCloneService<
2625
>;
2726

2827
#[allow(missing_docs)] // error types document themselves
29-
#[derive(Debug, Error)]
28+
#[derive(Debug, thiserror::Error)]
3029
pub enum GetClientError {
3130
#[error("bad uri: invalid scheme")]
3231
InvalidScheme,

zingolib/src/lightclient/send.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,14 @@ pub mod send_with_proposal {
3636

3737
use zcash_primitives::transaction::{Transaction, TxId};
3838

39-
use thiserror::Error;
4039
use zingo_status::confirmation_status::ConfirmationStatus;
4140

4241
use crate::lightclient::LightClient;
4342
use crate::wallet::now;
4443
use crate::wallet::propose::{ProposeSendError, ProposeShieldError};
4544

4645
#[allow(missing_docs)] // error types document themselves
47-
#[derive(Clone, Debug, Error)]
46+
#[derive(Clone, Debug, thiserror::Error)]
4847
pub enum TransactionCacheError {
4948
#[error("No witness trees. This is viewkey watch, not spendkey wallet.")]
5049
NoSpendCapability,
@@ -55,7 +54,7 @@ pub mod send_with_proposal {
5554
}
5655

5756
#[allow(missing_docs)] // error types document themselves
58-
#[derive(Clone, Debug, Error)]
57+
#[derive(Clone, Debug, thiserror::Error)]
5958
pub enum BroadcastCachedTransactionsError {
6059
#[error("Cant broadcast: {0:?}")]
6160
Cache(#[from] TransactionCacheError),
@@ -66,7 +65,7 @@ pub mod send_with_proposal {
6665
}
6766

6867
#[allow(missing_docs)] // error types document themselves
69-
#[derive(Debug, Error)]
68+
#[derive(Debug, thiserror::Error)]
7069
pub enum RecordCachedTransactionsError {
7170
#[error("Cant record: {0:?}")]
7271
Cache(#[from] TransactionCacheError),
@@ -77,7 +76,7 @@ pub mod send_with_proposal {
7776
}
7877

7978
#[allow(missing_docs)] // error types document themselves
80-
#[derive(Debug, Error)]
79+
#[derive(Debug, thiserror::Error)]
8180
pub enum CompleteAndBroadcastError {
8281
#[error("The transaction could not be calculated: {0:?}")]
8382
BuildTransaction(#[from] crate::wallet::send::BuildTransactionError),
@@ -90,7 +89,7 @@ pub mod send_with_proposal {
9089
}
9190

9291
#[allow(missing_docs)] // error types document themselves
93-
#[derive(Debug, Error)]
92+
#[derive(Debug, thiserror::Error)]
9493
pub enum CompleteAndBroadcastStoredProposalError {
9594
#[error("No proposal. Call do_propose first.")]
9695
NoStoredProposal,
@@ -99,7 +98,7 @@ pub mod send_with_proposal {
9998
}
10099

101100
#[allow(missing_docs)] // error types document themselves
102-
#[derive(Debug, Error)]
101+
#[derive(Debug, thiserror::Error)]
103102
pub enum QuickSendError {
104103
#[error("propose send {0:?}")]
105104
ProposeSend(#[from] ProposeSendError),
@@ -108,7 +107,7 @@ pub mod send_with_proposal {
108107
}
109108

110109
#[allow(missing_docs)] // error types document themselves
111-
#[derive(Debug, Error)]
110+
#[derive(Debug, thiserror::Error)]
112111
pub enum QuickShieldError {
113112
#[error("propose shield {0:?}")]
114113
Propose(#[from] ProposeShieldError),

zingolib/src/utils/conversion.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
//! Conversion specific utilities
22
3-
use thiserror::Error;
4-
53
use zcash_address::ZcashAddress;
64
use zcash_primitives::transaction::{components::amount::NonNegativeAmount, TxId};
75

86
use super::error::ConversionError;
97

108
#[allow(missing_docs)] // error types document themselves
11-
#[derive(Debug, Error)]
9+
#[derive(Debug, thiserror::Error)]
1210
pub enum TxIdFromHexEncodedStrError {
1311
#[error("{0}")]
1412
Decode(hex::FromHexError),

zingolib/src/wallet/error.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
//! Errors for [`crate::wallet`] and sub-modules
22
3-
use thiserror::Error;
43
use zcash_keys::keys::DerivationError;
54

65
use crate::wallet::data::OutgoingTxData;
76

87
/// Errors associated with transaction fee calculation
9-
#[derive(Debug, Error)]
8+
#[derive(Debug, thiserror::Error)]
109
pub enum FeeError {
1110
/// Sapling notes spent in a transaction not found in the wallet
1211
#[error("Sapling nullifier(s) {0:?} for this transaction not found in wallet. Is the wallet fully synced?")]
@@ -33,7 +32,7 @@ pub enum FeeError {
3332
}
3433

3534
/// Errors associated with balance calculation
36-
#[derive(Debug, Error)]
35+
#[derive(Debug, thiserror::Error)]
3736
pub enum BalanceError {
3837
/// failed to retrieve full viewing key
3938
#[error("failed to retrieve full viewing key.")]
@@ -44,7 +43,7 @@ pub enum BalanceError {
4443
}
4544

4645
/// Errors associated with balance key derivation
47-
#[derive(Debug, Error)]
46+
#[derive(Debug, thiserror::Error)]
4847
pub enum KeyError {
4948
/// Error asociated with standard IO
5049
#[error("{0}")]

zingolib/src/wallet/propose.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use std::{convert::Infallible, num::NonZeroU32, ops::DerefMut as _};
44

5-
use thiserror::Error;
65
use zcash_client_backend::{
76
data_api::wallet::input_selection::GreedyInputSelector,
87
zip321::{TransactionRequest, Zip321Error},
@@ -42,7 +41,7 @@ fn build_default_giskit(memo: Option<MemoBytes>) -> GISKit {
4241
}
4342

4443
/// Errors that can result from do_propose
45-
#[derive(Debug, Error)]
44+
#[derive(Debug, thiserror::Error)]
4645
pub enum ProposeSendError {
4746
/// error in using trait to create spend proposal
4847
#[error("{0}")]
@@ -69,7 +68,7 @@ pub enum ProposeSendError {
6968
}
7069

7170
/// Errors that can result from do_propose
72-
#[derive(Debug, Error)]
71+
#[derive(Debug, thiserror::Error)]
7372
pub enum ProposeShieldError {
7473
/// error in parsed addresses
7574
#[error("{0}")]

zingolib/src/wallet/send.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@ impl LightWallet {
8989
}
9090
}
9191

92-
use thiserror::Error;
9392
#[allow(missing_docs)] // error types document themselves
94-
#[derive(Debug, Error)]
93+
#[derive(Debug, thiserror::Error)]
9594
pub enum BuildTransactionError {
9695
#[error("No witness trees. This is viewkey watch, not spendkey wallet.")]
9796
NoSpendCapability,

zingolib/src/wallet/transaction_records_by_id/trait_inputsource.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ use zcash_primitives::{
1919
use crate::wallet::{notes::OutputInterface, transaction_records_by_id::TransactionRecordsById};
2020

2121
use std::fmt::Debug;
22-
use thiserror::Error;
2322

2423
use zcash_client_backend::wallet::NoteId;
2524
use zcash_primitives::transaction::components::amount::BalanceError;
2625

2726
/// Error type used by InputSource trait
28-
#[derive(Debug, PartialEq, Error)]
27+
#[derive(Debug, PartialEq, thiserror::Error)]
2928
pub enum InputSourceError {
3029
/// No witness position found for note. Note cannot be spent.
3130
#[error("No witness position found for note. Note cannot be spent: {0:?}")]

zingolib/src/wallet/tx_map.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use crate::{
1313
use getset::{Getters, MutGetters};
1414
use spending_data::SpendingData;
1515
use std::{fmt::Debug, sync::Arc};
16-
use thiserror::Error;
1716
use zcash_client_backend::wallet::TransparentAddressMetadata;
1817
use zcash_primitives::legacy::{keys::EphemeralIvk, TransparentAddress};
1918

@@ -87,7 +86,7 @@ impl TxMap {
8786
}
8887
}
8988
#[allow(missing_docs)] // error types document themselves
90-
#[derive(Debug, Error)]
89+
#[derive(Debug, thiserror::Error)]
9190
pub enum TxMapTraitError {
9291
#[error("No witness trees. This is viewkey watch, not a spendkey wallet.")]
9392
NoSpendCapability,

0 commit comments

Comments
 (0)