Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gfusee committed Nov 12, 2023
1 parent 2a777fc commit e2f55e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
20 changes: 8 additions & 12 deletions data/src/error/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,17 @@ use serde::{Deserialize, Serialize};
/// a centralized error type for broader error handling.
///
/// # Variants
/// - `InvalidBech32String`: This error occurs when attempting to construct an `Address`
/// from an invalid Bech32 string.
/// - `CannotConvertToBech32String`: This error occurs when attempting to convert an `Address`
/// to its Bech32 string representation.
///
/// # Example
/// ```
/// # use novax_data::{AddressError, DataError};
/// let error = AddressError::InvalidBech32String;
/// let data_error: DataError = error.into();
/// ```
/// - `InvalidBech32String`: Represents an error case where an invalid Bech32 string is provided.
/// - `CannotConvertToBech32String`: Represents an error case where an `Address` cannot be converted to its
/// Bech32 string representation.
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
pub enum AddressError {
/// Represents an error case where an invalid Bech32 string is provided.
InvalidBech32String { invalid_value: String },
InvalidBech32String {
/// The invalid Bech32 string that led to the error. Storing this string helps in diagnosing
/// the specific input that failed to parse, facilitating easier troubleshooting.
invalid_value: String
},
/// Represents an error case where an `Address` cannot be converted to its Bech32 string representation.
CannotConvertToBech32String,
}
Expand Down
12 changes: 0 additions & 12 deletions data/src/error/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@ use crate::error::utils::UtilsError;
/// as represented by the `AddressError` enum.
/// - `Utils(UtilsError)`: Encapsulates errors that occur within utility functions,
/// as represented by the `UtilsError` enum.
///
/// # Example
/// ```
/// # use novax_data::{DataError, AddressError};
/// let address_error = AddressError::InvalidBech32String;
/// let data_error: DataError = address_error.into();
///
/// match data_error {
/// DataError::Address(err) => println!("Address error: {:?}", err),
/// DataError::Utils(err) => println!("Utils error: {:?}", err),
/// }
/// ```
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
pub enum DataError {
/// Represents an error from address-related operations.
Expand Down

0 comments on commit e2f55e8

Please sign in to comment.