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 #[error("I/O error: {0}")]
41 IoError(String),
42}
43
44impl BatchError {
45 pub fn invalid_config(msg: impl Into<String>) -> Self {
47 Self::InvalidConfig(msg.into())
48 }
49
50 pub fn resource_exhausted(msg: impl Into<String>) -> Self {
52 Self::ResourceExhausted(msg.into())
53 }
54
55 pub fn crypto_error(msg: impl Into<String>) -> Self {
57 Self::CryptoError(msg.into())
58 }
59
60 pub fn parallel_error(msg: impl Into<String>) -> Self {
62 Self::ParallelError(msg.into())
63 }
64
65 pub fn generation_error(msg: impl Into<String>) -> Self {
67 Self::GenerationError(msg.into())
68 }
69
70 pub fn scanner_error(msg: impl Into<String>) -> Self {
72 Self::ScannerError(msg.into())
73 }
74
75 pub fn stream_error(msg: impl Into<String>) -> Self {
77 Self::StreamError(msg.into())
78 }
79
80 pub fn io_error(msg: impl Into<String>) -> Self {
82 Self::IoError(msg.into())
83 }
84}