Switch rest stuff of data/downloader to Failure Crate.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user