Improve error handling

This commit is contained in:
Julian Ospald 2017-07-22 16:24:32 +02:00
parent 01a8a57235
commit 7904c00aa8
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
2 changed files with 6 additions and 9 deletions

View File

@ -1,6 +1,7 @@
#![allow(missing_docs)] #![allow(missing_docs)]
use alsa_lib; use alsa_lib;
use glib;
use png; use png;
use std::convert::From; use std::convert::From;
use std; use std;
@ -14,6 +15,7 @@ error_chain! {
IO(std::io::Error); IO(std::io::Error);
Toml(toml::de::Error); Toml(toml::de::Error);
Png(png::DecodingError); Png(png::DecodingError);
GlibError(glib::Error);
} }
errors { errors {

View File

@ -108,16 +108,13 @@ impl Notif {
} }
}; };
// TODO: error handling
self.volume_notif self.volume_notif
.update(summary.as_str(), None, Some(icon)) .update(summary.as_str(), None, Some(icon))?;
.unwrap();
self.volume_notif.set_hint( self.volume_notif.set_hint(
"value", "value",
Some((vol as i32).to_variant()), Some((vol as i32).to_variant()),
); );
// TODO: error handling self.volume_notif.show()?;
self.volume_notif.show().unwrap();
return Ok(()); return Ok(());
} }
@ -125,10 +122,8 @@ impl Notif {
/// Shows a text notification, e.g. for warnings or errors. /// Shows a text notification, e.g. for warnings or errors.
pub fn show_text_notif(&self, summary: &str, body: &str) -> Result<()> { pub fn show_text_notif(&self, summary: &str, body: &str) -> Result<()> {
// TODO: error handling self.text_notif.update(summary, Some(body), None)?;
self.text_notif.update(summary, Some(body), None).unwrap(); self.text_notif.show()?;
// TODO: error handling
self.text_notif.show().unwrap();
return Ok(()); return Ok(());
} }