From ff3f7c04139166b4b3ee5d17889129fbdb5fdff9 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sat, 22 Jul 2017 18:58:13 -0400 Subject: Handle possible failure to save --- Cargo.toml | 2 +- src/main.rs | 4 +++- src/structs.rs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5317aaf..e4b3c1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "podcast" -version = "0.2.2" +version = "0.2.3" authors = ["njaremko "] description = "A command line podcast player" license = "GPL-3.0" diff --git a/src/main.rs b/src/main.rs index 52ab321..6f23c6a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -123,5 +123,7 @@ fn main() { Some("update") => update_rss(&state), _ => (), } - state.save(); + if let Err(err) = state.save() { + eprintln!("{}", err); + } } diff --git a/src/structs.rs b/src/structs.rs index 0139394..e0088be 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -60,7 +60,7 @@ impl State { }); } if let Err(err) = self.save() { - println!("{}", err); + eprintln!("{}", err); } // TODO only download new rss, don't refresh all update_rss(&self.clone()); -- cgit v1.2.3