From aa139d766ed110ce1844bf6dec7c31ff6c025a60 Mon Sep 17 00:00:00 2001 From: Adam Simpson Date: Wed, 18 Dec 2019 00:03:03 -0500 Subject: [PATCH] refactor: try to move to error handling as outlined in the book. --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 92 ++++++++++++++++++++++++++++++++--------------------- 3 files changed, 58 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5665b7..269d26a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -725,7 +725,7 @@ dependencies = [ [[package]] name = "oscar" -version = "0.1.2" +version = "0.1.3" dependencies = [ "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 2d45e70..9a19191 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oscar" -version = "0.1.2" +version = "0.1.3" authors = ["Adam Simpson "] edition = "2018" description = "A CLI application to download Sesame Street videos from PBS. Ideally run in cron or another scheduler." diff --git a/src/main.rs b/src/main.rs index eb6988a..6ea4c90 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,13 @@ extern crate log; extern crate reqwest; extern crate simple_logger; +use log::error; use log::info; use serde::Deserialize; use std::fs; use std::io::copy; use std::path::PathBuf; +use std::process; use structopt::StructOpt; #[derive(StructOpt, Debug)] @@ -50,12 +52,12 @@ impl Episode { self.title.replace(" ", "-") } - fn get_video_object(&self) -> Vec