Improve error handling
This commit is contained in:
parent
01a8a57235
commit
7904c00aa8
@ -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 {
|
||||||
|
13
src/notif.rs
13
src/notif.rs
@ -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(());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user