Switch rest stuff of data/downloader to Failure Crate.

This commit is contained in:
Jordan Petridis
2018-02-04 17:36:27 +02:00
parent f9f015a211
commit de43cae015
20 changed files with 102 additions and 97 deletions
+4 -2
View File
@@ -11,11 +11,13 @@ use std::io::{BufWriter, Read, Write};
use std::path::Path;
use std::sync::{Arc, Mutex};
use errors::*;
use hammond_data::{EpisodeWidgetQuery, PodcastCoverQuery, Save};
use hammond_data::xdg_dirs::HAMMOND_CACHE;
// use failure::Error;
use std::result;
use failure::Error;
type Result<T> = result::Result<T, 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.
+1 -11
View File
@@ -2,19 +2,9 @@ use hammond_data;
use reqwest;
use std::io;
error_chain! {
foreign_links {
ReqError(reqwest::Error);
IoError(io::Error);
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 = "Data error: {}", _0)] DataError(hammond_data::errors::DatabaseError),
#[fail(display = "Io error: {}", _0)] IoError(io::Error),
}
+1 -2
View File
@@ -2,13 +2,12 @@
// #![deny(unused_extern_crates, unused)]
#[macro_use]
extern crate error_chain;
extern crate failure;
#[macro_use]
extern crate failure_derive;
#[macro_use]
extern crate log;
extern crate failure;
extern crate glob;
extern crate hammond_data;
extern crate hyper;