thiserror 2.0, cargo update

This commit is contained in:
Luke Parker
2024-12-08 21:55:37 -05:00
parent 3192370484
commit 18897978d0
35 changed files with 645 additions and 667 deletions

View File

@@ -18,7 +18,7 @@ workspace = true
[dependencies]
std-shims = { path = "../../../../common/std-shims", version = "^0.1.1", default-features = false }
thiserror = { version = "1", default-features = false, optional = true }
thiserror = { version = "2", default-features = false }
zeroize = { version = "^1.5", default-features = false, features = ["zeroize_derive"] }
@@ -40,7 +40,7 @@ serde_json = { version = "1", default-features = false, features = ["alloc"] }
std = [
"std-shims/std",
"thiserror",
"thiserror/std",
"zeroize/std",

View File

@@ -199,29 +199,25 @@ pub enum Network {
}
/// Errors when decoding an address.
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "std", derive(thiserror::Error))]
#[derive(Clone, Copy, PartialEq, Eq, Debug, thiserror::Error)]
pub enum AddressError {
/// The address had an invalid (network, type) byte.
#[cfg_attr(feature = "std", error("invalid byte for the address's network/type ({0})"))]
#[error("invalid byte for the address's network/type ({0})")]
InvalidTypeByte(u8),
/// The address wasn't a valid Base58Check (as defined by Monero) string.
#[cfg_attr(feature = "std", error("invalid address encoding"))]
#[error("invalid address encoding")]
InvalidEncoding,
/// The data encoded wasn't the proper length.
#[cfg_attr(feature = "std", error("invalid length"))]
#[error("invalid length")]
InvalidLength,
/// The address had an invalid key.
#[cfg_attr(feature = "std", error("invalid key"))]
#[error("invalid key")]
InvalidKey,
/// The address was featured with unrecognized features.
#[cfg_attr(feature = "std", error("unknown features"))]
#[error("unknown features")]
UnknownFeatures(u64),
/// The network was for a different network than expected.
#[cfg_attr(
feature = "std",
error("different network ({actual:?}) than expected ({expected:?})")
)]
#[error("different network ({actual:?}) than expected ({expected:?})")]
DifferentNetwork {
/// The Network expected.
expected: Network,