Add rest of the From impls for the Error Type.
This commit is contained in:
parent
ede4c21e30
commit
435ce05ac7
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -630,7 +630,6 @@ dependencies = [
|
|||||||
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"reqwest 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rfc822_sanitizer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rfc822_sanitizer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rss 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rss 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|||||||
@ -14,7 +14,6 @@ itertools = "0.7.6"
|
|||||||
lazy_static = "1.0.0"
|
lazy_static = "1.0.0"
|
||||||
log = "0.4.1"
|
log = "0.4.1"
|
||||||
rayon = "0.9.0"
|
rayon = "0.9.0"
|
||||||
reqwest = "0.8.4"
|
|
||||||
rfc822_sanitizer = "0.3.3"
|
rfc822_sanitizer = "0.3.3"
|
||||||
rss = "1.2.1"
|
rss = "1.2.1"
|
||||||
url = "1.6.0"
|
url = "1.6.0"
|
||||||
|
|||||||
@ -3,7 +3,6 @@ use diesel::r2d2;
|
|||||||
use diesel_migrations::RunMigrationsError;
|
use diesel_migrations::RunMigrationsError;
|
||||||
use hyper;
|
use hyper;
|
||||||
use native_tls;
|
use native_tls;
|
||||||
use reqwest;
|
|
||||||
// use rss;
|
// use rss;
|
||||||
use url;
|
use url;
|
||||||
|
|
||||||
@ -29,11 +28,9 @@ pub enum DataError {
|
|||||||
R2D2Error(#[cause] r2d2::Error),
|
R2D2Error(#[cause] r2d2::Error),
|
||||||
#[fail(display = "R2D2 Pool error: {}", _0)]
|
#[fail(display = "R2D2 Pool error: {}", _0)]
|
||||||
R2D2PoolError(#[cause] r2d2::PoolError),
|
R2D2PoolError(#[cause] r2d2::PoolError),
|
||||||
#[fail(display = "Reqwest Error: {}", _0)]
|
|
||||||
ReqError(#[cause] reqwest::Error),
|
|
||||||
#[fail(display = "Hyper Error: {}", _0)]
|
#[fail(display = "Hyper Error: {}", _0)]
|
||||||
HyperError(#[cause] hyper::Error),
|
HyperError(#[cause] hyper::Error),
|
||||||
#[fail(display = "Url Error: {}", _0)]
|
#[fail(display = "Failed to parse a url: {}", _0)]
|
||||||
UrlError(#[cause] url::ParseError),
|
UrlError(#[cause] url::ParseError),
|
||||||
#[fail(display = "TLS Error: {}", _0)]
|
#[fail(display = "TLS Error: {}", _0)]
|
||||||
TLSError(#[cause] native_tls::Error),
|
TLSError(#[cause] native_tls::Error),
|
||||||
@ -62,3 +59,21 @@ impl From<r2d2::PoolError> for DataError {
|
|||||||
DataError::R2D2PoolError(err)
|
DataError::R2D2PoolError(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<hyper::Error> for DataError {
|
||||||
|
fn from(err: hyper::Error) -> Self {
|
||||||
|
DataError::HyperError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<url::ParseError> for DataError {
|
||||||
|
fn from(err: url::ParseError) -> Self {
|
||||||
|
DataError::UrlError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<native_tls::Error> for DataError {
|
||||||
|
fn from(err: native_tls::Error) -> Self {
|
||||||
|
DataError::TLSError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -46,7 +46,6 @@ extern crate itertools;
|
|||||||
extern crate native_tls;
|
extern crate native_tls;
|
||||||
extern crate num_cpus;
|
extern crate num_cpus;
|
||||||
extern crate rayon;
|
extern crate rayon;
|
||||||
extern crate reqwest;
|
|
||||||
extern crate rfc822_sanitizer;
|
extern crate rfc822_sanitizer;
|
||||||
extern crate rss;
|
extern crate rss;
|
||||||
extern crate tokio_core;
|
extern crate tokio_core;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user