tun_sync/
error.rs

1//            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2//                    Version 2, December 2004
3//
4// Copyleft (ↄ) meh. <meh@schizofreni.co> | http://meh.schizofreni.co
5//
6// Everyone is permitted to copy and distribute verbatim or modified
7// copies of this license document, and changing it is allowed as long
8// as the name is changed.
9//
10//            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11//   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12//
13//  0. You just DO WHAT THE FUCK YOU WANT TO.
14
15use std::{ffi, io, num};
16use thiserror::Error;
17
18#[derive(Error, Debug)]
19pub enum Error {
20    #[error("invalid configuration")]
21    InvalidConfig,
22
23    #[error("not implementated")]
24    NotImplemented,
25
26    #[error("device name too long")]
27    NameTooLong,
28
29    #[error("invalid device name")]
30    InvalidName,
31
32    #[error("invalid address")]
33    InvalidAddress,
34
35    #[error("invalid file descriptor")]
36    InvalidDescriptor,
37
38    #[error("unsuported network layer of operation")]
39    UnsupportedLayer,
40
41    #[error("invalid queues number")]
42    InvalidQueuesNumber,
43
44    #[error(transparent)]
45    Io(#[from] io::Error),
46
47    #[error(transparent)]
48    Nul(#[from] ffi::NulError),
49
50    #[error(transparent)]
51    ParseNum(#[from] num::ParseIntError),
52}
53
54pub type Result<T> = ::std::result::Result<T, Error>;