mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-21 00:20:53 +00:00
error issues
This commit is contained in:
parent
53daaed385
commit
8adfd8a0c1
2 changed files with 12 additions and 3 deletions
11
src/error.rs
11
src/error.rs
|
@ -6,7 +6,7 @@ pub enum Error {
|
|||
#[error("ctrlc::Error {0:?}")]
|
||||
InterruptHandler(#[from] ctrlc::Error),
|
||||
|
||||
#[error("std::io::Error {0}")]
|
||||
#[error(transparent)]
|
||||
Io(#[from] std::io::Error),
|
||||
|
||||
#[error("TryFromIntError {0:?}")]
|
||||
|
@ -84,4 +84,13 @@ impl From<&String> for Error {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Error> for std::io::Error {
|
||||
fn from(err: Error) -> Self {
|
||||
match err {
|
||||
Error::Io(err) => err,
|
||||
_ => std::io::Error::new(std::io::ErrorKind::Other, err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub type Result<T, E = Error> = std::result::Result<T, E>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue