corevpn_core/
error.rs

1//! Core error types
2
3use thiserror::Error;
4
5/// Result type for core operations
6pub type Result<T> = std::result::Result<T, CoreError>;
7
8/// Core errors
9#[derive(Debug, Error)]
10pub enum CoreError {
11    /// Session not found
12    #[error("session not found: {0}")]
13    SessionNotFound(String),
14
15    /// Session expired
16    #[error("session expired")]
17    SessionExpired,
18
19    /// User not found
20    #[error("user not found: {0}")]
21    UserNotFound(String),
22
23    /// User not authorized
24    #[error("user not authorized: {0}")]
25    Unauthorized(String),
26
27    /// Address pool exhausted
28    #[error("no available addresses in pool")]
29    AddressPoolExhausted,
30
31    /// Invalid address
32    #[error("invalid address: {0}")]
33    InvalidAddress(String),
34
35    /// Configuration error
36    #[error("configuration error: {0}")]
37    ConfigError(String),
38
39    /// Cryptographic error
40    #[error("crypto error: {0}")]
41    CryptoError(#[from] corevpn_crypto::CryptoError),
42
43    /// IO error
44    #[error("IO error: {0}")]
45    IoError(#[from] std::io::Error),
46
47    /// Internal error
48    #[error("internal error: {0}")]
49    Internal(String),
50}