Error handling cleanup.

This commit is contained in:
Jordan Petridis
2017-10-04 23:51:53 +03:00
parent f25ce64e34
commit bf9e544a2b
9 changed files with 29 additions and 43 deletions
-11
View File
@@ -4,24 +4,13 @@ version = "0.1.0"
authors = ["Jordan Petridis <jordanpetridis@protonmail.com>"]
[dependencies]
rfc822_sanitizer = "0.3.0"
rayon = "0.8.2"
regex = "0.2"
error-chain = "0.11.0"
structopt = "0.1.0"
structopt-derive = "0.1.0"
log = "0.3.8"
loggerv = "0.3.0"
reqwest = "0.7.3"
hyper = "0.11.2"
diesel = { version = "0.16.0", features = ["sqlite", "deprecated-time", "chrono"] }
diesel_codegen = { version = "0.16.0", features = ["sqlite"] }
time = "0.1.38"
xdg = "2.1.0"
lazy_static = "0.2.8"
chrono = "0.4.0"
rss = { version = "1.1.0", features = ["from_url"]}
# overide diesel's dependancy that would otherwise turn a dotenv feature of
# that rss depends upon
dotenv = "*"
+1 -26
View File
@@ -15,14 +15,8 @@ extern crate diesel;
#[macro_use]
extern crate diesel_codegen;
extern crate chrono;
extern crate hyper;
extern crate rayon;
extern crate regex;
extern crate reqwest;
extern crate rfc822_sanitizer;
extern crate rss;
extern crate time;
extern crate xdg;
pub mod dbqueries;
@@ -31,33 +25,13 @@ pub mod schema;
pub mod errors {
use reqwest;
use rss;
use chrono;
use hyper;
use time;
use diesel::migrations::RunMigrationsError;
use diesel::result;
use regex;
use std::io;
// use std::option;
// use std::sync;
error_chain! {
foreign_links {
ReqError(reqwest::Error);
IoError(io::Error);
Log(::log::SetLoggerError);
MigrationError(RunMigrationsError);
RSSError(rss::Error);
DieselResultError(result::Error);
ChronoError(chrono::ParseError);
DurationError(time::OutOfRangeError);
HyperError(hyper::error::Error);
RegexError(regex::Error);
// NoneError(option::NoneError);
// MutexPoison(sync::PoisonError);
}
}
}
@@ -109,6 +83,7 @@ pub fn init() -> Result<()> {
}
pub fn run_migration_on(connection: &SqliteConnection) -> Result<()> {
info!("Running DB Migrations...");
embedded_migrations::run_with_output(connection, &mut std::io::stdout())?;
Ok(())
}
-1
View File
@@ -1,5 +1,4 @@
use reqwest;
use rss::Channel;
use diesel::SaveChangesDsl;
use SqliteConnection;
use reqwest::header::{ETag, LastModified};