vpncloud/src/error.rs

56 lines
1.4 KiB
Rust
Raw Normal View History

2021-02-08 09:11:20 +00:00
// VpnCloud - Peer-to-Peer VPN
// Copyright (C) 2015-2021 Dennis Schwerdel
// This software is licensed under GPL-3 or newer (see LICENSE.md)
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}")]
2021-04-06 10:28:31 +00:00
NameUnresolvable(String),
2020-09-24 17:48:13 +00:00
}