rustywallet_batch/
error.rs1use thiserror::Error;
7
8#[derive(Debug, Error)]
10pub enum BatchError {
11 #[error("Invalid configuration: {0}")]
13 InvalidConfig(String),
14
15 #[error("Insufficient system resources: {0}")]
17 ResourceExhausted(String),
18
19 #[error("Cryptographic operation failed: {0}")]
21 CryptoError(String),
22
23 #[error("Parallel processing error: {0}")]
25 ParallelError(String),
26
27 #[error("Key generation failed: {0}")]
29 GenerationError(String),
30
31 #[error("Scanner operation failed: {0}")]
33 ScannerError(String),
34
35 #[error("Stream operation failed: {0}")]
37 StreamError(String),
38}
39
40impl BatchError {
41 pub fn invalid_config(msg: impl Into<String>) -> Self {
43 Self::InvalidConfig(msg.into())
44 }
45
46 pub fn resource_exhausted(msg: impl Into<String>) -> Self {
48 Self::ResourceExhausted(msg.into())
49 }
50
51 pub fn crypto_error(msg: impl Into<String>) -> Self {
53 Self::CryptoError(msg.into())
54 }
55
56 pub fn parallel_error(msg: impl Into<String>) -> Self {
58 Self::ParallelError(msg.into())
59 }
60
61 pub fn generation_error(msg: impl Into<String>) -> Self {
63 Self::GenerationError(msg.into())
64 }
65
66 pub fn scanner_error(msg: impl Into<String>) -> Self {
68 Self::ScannerError(msg.into())
69 }
70
71 pub fn stream_error(msg: impl Into<String>) -> Self {
73 Self::StreamError(msg.into())
74 }
75}