pub enum SparkSdkError {
Network(NetworkError),
Wallet(WalletError),
Crypto(CryptoError),
Validation(ValidationError),
Transaction(TransactionError),
Io(IoError),
Internal(InternalError),
General(String),
}
Expand description
Main error type for the Spark Wallet SDK.
This enum wraps all subcategory errors and provides a uniform error
interface for SDK functions. Most SDK methods return Result<T, SparkSdkError>
.
When handling errors, you can either match on the specific error type:
match error {
SparkSdkError::Network(network_error) => {
// Handle network-specific errors
println!("Network error: {}", network_error);
},
SparkSdkError::Wallet(wallet_error) => {
// Handle wallet-specific errors
println!("Wallet error: {}", wallet_error);
},
// Other error categories...
_ => println!("Other error: {}", error),
}
Or simply use the error’s Display
implementation for general handling:
println!("Error occurred: {}", error);
Variants§
Network(NetworkError)
Network communication errors, including RPC calls and HTTP requests.
Wallet(WalletError)
Wallet operation errors, including leaf management and funds handling.
Crypto(CryptoError)
Cryptographic operation errors, including signing and key management.
Validation(ValidationError)
Input validation errors, parameter checking, and verification issues.
Transaction(TransactionError)
Bitcoin transaction errors, including creation and processing issues.
Io(IoError)
Input/output errors, including serialization and file operations.
Internal(InternalError)
SDK internal errors, typically for initialization or processing problems.
General(String)
General errors with a string message for cases that don’t fit other categories.
Trait Implementations§
Source§impl Debug for SparkSdkError
impl Debug for SparkSdkError
Source§impl Display for SparkSdkError
impl Display for SparkSdkError
Source§impl Error for SparkSdkError
impl Error for SparkSdkError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<&str> for SparkSdkError
impl From<&str> for SparkSdkError
Source§impl From<CryptoError> for SparkSdkError
impl From<CryptoError> for SparkSdkError
Source§fn from(source: CryptoError) -> Self
fn from(source: CryptoError) -> Self
Source§impl From<Error> for SparkSdkError
impl From<Error> for SparkSdkError
Source§impl From<Error> for SparkSdkError
impl From<Error> for SparkSdkError
Source§impl From<InternalError> for SparkSdkError
impl From<InternalError> for SparkSdkError
Source§fn from(source: InternalError) -> Self
fn from(source: InternalError) -> Self
Source§impl From<IoError> for SparkSdkError
impl From<IoError> for SparkSdkError
Source§impl From<NetworkError> for SparkSdkError
impl From<NetworkError> for SparkSdkError
Source§fn from(source: NetworkError) -> Self
fn from(source: NetworkError) -> Self
Source§impl From<String> for SparkSdkError
impl From<String> for SparkSdkError
Source§impl From<TransactionError> for SparkSdkError
impl From<TransactionError> for SparkSdkError
Source§fn from(source: TransactionError) -> Self
fn from(source: TransactionError) -> Self
Source§impl From<ValidationError> for SparkSdkError
impl From<ValidationError> for SparkSdkError
Source§fn from(source: ValidationError) -> Self
fn from(source: ValidationError) -> Self
Source§impl From<WalletError> for SparkSdkError
impl From<WalletError> for SparkSdkError
Source§fn from(source: WalletError) -> Self
fn from(source: WalletError) -> Self
Auto Trait Implementations§
impl !Freeze for SparkSdkError
impl !RefUnwindSafe for SparkSdkError
impl Send for SparkSdkError
impl Sync for SparkSdkError
impl Unpin for SparkSdkError
impl !UnwindSafe for SparkSdkError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request