Error types cleanup.
This commit is contained in:
parent
7b5bca2162
commit
36271afcdd
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -547,7 +547,6 @@ dependencies = [
|
||||
"diesel_codegen 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dotenv 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.11.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
||||
@ -7,7 +7,6 @@ workspace = "../"
|
||||
[dependencies]
|
||||
rfc822_sanitizer = "0.3"
|
||||
rayon = "0.8"
|
||||
hyper = "0.11"
|
||||
reqwest = "0.8"
|
||||
error-chain = "0.11"
|
||||
log = "0.3"
|
||||
|
||||
@ -1,19 +1,13 @@
|
||||
use diesel::migrations::RunMigrationsError;
|
||||
use diesel::result;
|
||||
use rss;
|
||||
use hyper;
|
||||
use reqwest;
|
||||
use log;
|
||||
|
||||
use std::io;
|
||||
|
||||
error_chain! {
|
||||
foreign_links {
|
||||
LogError(log::SetLoggerError);
|
||||
MigrationError(RunMigrationsError);
|
||||
DieselResultError(result::Error);
|
||||
RSSError(rss::Error);
|
||||
HyperError(hyper::error::Error);
|
||||
ReqError(reqwest::Error);
|
||||
IoError(io::Error);
|
||||
}
|
||||
|
||||
@ -16,7 +16,6 @@ extern crate diesel;
|
||||
extern crate diesel_codegen;
|
||||
|
||||
extern crate chrono;
|
||||
extern crate hyper;
|
||||
extern crate rayon;
|
||||
extern crate reqwest;
|
||||
extern crate rfc822_sanitizer;
|
||||
@ -31,8 +30,8 @@ pub mod errors;
|
||||
mod feedparser;
|
||||
mod schema;
|
||||
|
||||
use diesel::migrations::RunMigrationsError;
|
||||
use diesel::prelude::*;
|
||||
use errors::*;
|
||||
use std::path::PathBuf;
|
||||
|
||||
embed_migrations!("migrations/");
|
||||
@ -64,18 +63,15 @@ lazy_static!{
|
||||
};
|
||||
}
|
||||
|
||||
pub fn init() -> Result<()> {
|
||||
pub fn init() -> Result<(), RunMigrationsError> {
|
||||
let conn = establish_connection();
|
||||
run_migration_on(&conn)?;
|
||||
|
||||
Ok(())
|
||||
run_migration_on(&conn)
|
||||
}
|
||||
|
||||
pub fn run_migration_on(connection: &SqliteConnection) -> Result<()> {
|
||||
pub fn run_migration_on(connection: &SqliteConnection) -> Result<(), RunMigrationsError> {
|
||||
info!("Running DB Migrations...");
|
||||
// embedded_migrations::run(&conn)?;
|
||||
embedded_migrations::run_with_output(connection, &mut std::io::stdout())?;
|
||||
Ok(())
|
||||
embedded_migrations::run(connection)
|
||||
// embedded_migrations::run_with_output(connection, &mut std::io::stdout())
|
||||
}
|
||||
|
||||
pub fn establish_connection() -> SqliteConnection {
|
||||
|
||||
@ -4,10 +4,10 @@ use gdk_pixbuf::Pixbuf;
|
||||
|
||||
use std::fs;
|
||||
|
||||
use hammond_data::models::Podcast;
|
||||
use hammond_downloader::downloader;
|
||||
use hammond_data::index_feed::Database;
|
||||
use hammond_data::dbqueries;
|
||||
use hammond_data::models::Podcast;
|
||||
use hammond_data::index_feed::Database;
|
||||
use hammond_downloader::downloader;
|
||||
|
||||
use widgets::episode::episodes_listbox;
|
||||
use podcasts_view::update_podcasts_view;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user