Log error when brightness change fails

Currently panics and closes the program, for example if there is an
permissions error (where i encountered it)
This commit is contained in:
Alex McGrath
2019-08-02 14:52:44 +02:00
committed by Kenny Levinsen
parent 1b8c041151
commit a52bc3f126
+14 -2
View File
@@ -143,7 +143,13 @@ impl ModuleImpl for Backlight {
y,
} => {
self.add(y as f32 / 8.0).unwrap();
self.sync().unwrap();
match self.sync() {
Ok(val) => val,
Err(err) => {
eprintln!("Error while trying to change brightness: {}", err);
()
}
}
}
Input::Click { pos: _pos, button } => {
match button {
@@ -154,7 +160,13 @@ impl ModuleImpl for Backlight {
} else {
1
};
self.sync().unwrap();
match self.sync() {
Ok(val) => val,
Err(err) => {
eprintln!("Error while trying to change brightness: {}", err);
()
}
}
}
_ => {}
}