1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, CoreError>;
7
8#[derive(Debug, Error)]
10pub enum CoreError {
11 #[error("session not found: {0}")]
13 SessionNotFound(String),
14
15 #[error("session expired")]
17 SessionExpired,
18
19 #[error("user not found: {0}")]
21 UserNotFound(String),
22
23 #[error("user not authorized: {0}")]
25 Unauthorized(String),
26
27 #[error("no available addresses in pool")]
29 AddressPoolExhausted,
30
31 #[error("invalid address: {0}")]
33 InvalidAddress(String),
34
35 #[error("configuration error: {0}")]
37 ConfigError(String),
38
39 #[error("crypto error: {0}")]
41 CryptoError(#[from] corevpn_crypto::CryptoError),
42
43 #[error("IO error: {0}")]
45 IoError(#[from] std::io::Error),
46
47 #[error("internal error: {0}")]
49 Internal(String),
50}