31 lines
641 B
Rust
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)
|
|
}
|
|
}
|