vpncloud/src/error.rs

53 lines
1.3 KiB
Rust
Raw Normal View History

2020-09-24 17:48:13 +00:00
use thiserror::Error;
use std::io;
#[derive(Error, Debug)]
pub enum Error {
2020-10-28 17:54:17 +00:00
/// Crypto init error, this is recoverable
2020-09-24 17:48:13 +00:00
#[error("Crypto initialization error: {0}")]
CryptoInit(&'static str),
2020-10-28 17:54:17 +00:00
/// Crypto init error, this is fatal and the init needs to be aborted
#[error("Fatal crypto initialization error: {0}")]
CryptoInitFatal(&'static str),
2020-10-06 20:52:14 +00:00
/// Crypto error with this one message, no permanent error
2020-09-24 17:48:13 +00:00
#[error("Crypto error: {0}")]
Crypto(&'static str),
#[error("Invalid crypto state: {0}")]
InvalidCryptoState(&'static str),
#[error("Invalid config: {0}")]
InvalidConfig(&'static str),
#[error("Socker error: {0}")]
Socket(&'static str),
2020-11-07 11:04:25 +00:00
#[error("Socker error: {0} ({1})")]
2020-09-24 17:48:13 +00:00
SocketIo(&'static str, #[source] io::Error),
#[error("Device error: {0}")]
Device(&'static str),
2020-11-07 11:04:25 +00:00
#[error("Device error: {0} ({1})")]
2020-09-24 17:48:13 +00:00
DeviceIo(&'static str, #[source] io::Error),
#[error("File error: {0}")]
FileIo(&'static str, #[source] io::Error),
#[error("Message error: {0}")]
Message(&'static str),
2020-11-07 11:04:25 +00:00
#[error("Beacon error: {0} ({1})")]
2020-09-24 17:48:13 +00:00
BeaconIo(&'static str, #[source] io::Error),
#[error("Parse error: {0}")]
Parse(&'static str),
#[error("Name can not be resolved: {0}")]
NameUnresolvable(String)
}