yapilt/src/error.rs
Jan Christian Grünhage 6757ad28f8
initial commit
2020-04-19 15:40:43 +02:00

31 lines
641 B
Rust

use crate::{IpType, Provider};
use std::convert::From;
#[derive(Debug)]
pub enum Error {
Unsupported(IpType, Provider),
Http(http::Error),
#[cfg(feature = "reqwest-client")]
Reqwest(reqwest::Error),
}
impl From<(IpType, &Provider)> for Error {
fn from(tuple: (IpType, &Provider)) -> Self {
Self::Unsupported(tuple.0, tuple.1.clone())
}
}
impl From<http::Error> for Error {
fn from(error: http::Error) -> Self {
Self::Http(error)
}
}
#[cfg(feature = "reqwest-client")]
impl From<reqwest::Error> for Error {
fn from(error: reqwest::Error) -> Self {
Self::Reqwest(error)
}
}