Skip to main content

ant_node/
error.rs

1//! Error types for ant-node.
2
3use thiserror::Error;
4
5/// Result type alias using the crate's Error type.
6pub type Result<T> = std::result::Result<T, Error>;
7
8/// Errors that can occur in ant-node.
9#[derive(Error, Debug)]
10pub enum Error {
11    /// Configuration error.
12    #[error("configuration error: {0}")]
13    Config(String),
14
15    /// Node startup error.
16    #[error("node startup failed: {0}")]
17    Startup(String),
18
19    /// Network error from the core networking layer.
20    #[error("network error: {0}")]
21    Network(String),
22
23    /// Storage error.
24    #[error("storage error: {0}")]
25    Storage(String),
26
27    /// Payment error.
28    #[error("payment error: {0}")]
29    Payment(String),
30
31    /// Upgrade error.
32    #[error("upgrade error: {0}")]
33    Upgrade(String),
34
35    /// Cryptographic error.
36    #[error("crypto error: {0}")]
37    Crypto(String),
38
39    /// I/O error.
40    #[error("I/O error: {0}")]
41    Io(#[from] std::io::Error),
42
43    /// Serialization error.
44    #[error("serialization error: {0}")]
45    Serialization(String),
46
47    /// Protocol error.
48    #[error("protocol error: {0}")]
49    Protocol(String),
50
51    /// Invalid chunk error.
52    #[error("invalid chunk: {0}")]
53    InvalidChunk(String),
54
55    /// Node is shutting down.
56    #[error("node is shutting down")]
57    ShuttingDown,
58}