Hammond-data: switch database module to use Failure.

This commit is contained in:
Jordan Petridis
2018-02-04 16:33:10 +02:00
parent 3874235074
commit f9f015a211
10 changed files with 46 additions and 11 deletions
+2
View File
@@ -12,6 +12,8 @@ mime_guess = "1.8.3"
reqwest = "0.8.4"
tempdir = "0.3.5"
glob = "0.2.11"
failure = "0.1.1"
failure_derive = "0.1.1"
[dependencies.hammond-data]
path = "../hammond-data"
+2
View File
@@ -15,6 +15,8 @@ use errors::*;
use hammond_data::{EpisodeWidgetQuery, PodcastCoverQuery, Save};
use hammond_data::xdg_dirs::HAMMOND_CACHE;
// use failure::Error;
// TODO: Replace path that are of type &str with std::path.
// TODO: Have a convention/document absolute/relative paths, if they should end with / or not.
+9
View File
@@ -9,3 +9,12 @@ error_chain! {
DataError(hammond_data::errors::Error);
}
}
#[derive(Fail, Debug)]
enum DownloaderError {
#[fail(display = "Reqwest error: {}", _0)] RequestError(reqwest::Error),
// NOT SYNC.
// #[fail(display = "Data error: {}", _0)]
// DataError(hammond_data::errors::Error),
#[fail(display = "Io error: {}", _0)] IoError(io::Error),
}
+7 -3
View File
@@ -1,13 +1,17 @@
#![recursion_limit = "1024"]
#![deny(unused_extern_crates, unused)]
// #![deny(unused_extern_crates, unused)]
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate failure_derive;
#[macro_use]
extern crate log;
extern crate failure;
extern crate glob;
extern crate hammond_data;
extern crate hyper;
#[macro_use]
extern crate log;
extern crate mime_guess;
extern crate reqwest;
extern crate tempdir;