summary history branches tags files
commit:db75c87d3940fffb122583bb80ce46d577677f79
author:Trevor Bentley
committer:Trevor Bentley
date:Mon Jul 24 18:37:06 2017 +0200
parents:01f4c9c0a3f33aa9f5a4a9c5bebce9e6119958e4
Don't panic on failed Spotify commands
diff --git a/src/main.rs b/src/main.rs
line changes: +2/-5
index 449144f..3889a5b
--- a/src/main.rs
+++ b/src/main.rs
@@ -23,7 +23,6 @@ extern crate log4rs;
 use std::env;
 use std::ptr;
 use std::thread;
-use std::thread::sleep;
 use std::time::Duration;
 use std::sync::mpsc::channel;
 use std::sync::mpsc::{Sender, Receiver};
@@ -751,11 +750,9 @@ fn main() {
 
 fn require(response: SpotifyResponse) {
     match response.code.unwrap() {
-        200 ... 299 => (),
-        // TODO: Don't panic
-        _ => panic!("{}", response)
+        200 ... 299 => { info!("Response: {}", response.code.unwrap()); },
+        _ => { warn!("Spotify action failed! ({})", response); }
     }
-    println!("Response: {}", response.code.unwrap());
 }
 
 fn play_uri(spotify: &mut connectr::SpotifyConnectr, device: Option<&str>, uri: Option<&str>) {