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
+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};