mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Clean up unwrap()'s. Print out info in asusctl if error
This commit is contained in:
@@ -95,7 +95,7 @@ impl From<AnimeDataBuffer> for AnimePacketType {
|
||||
pub fn run_animation(
|
||||
frames: &AnimeGif,
|
||||
do_early_return: Arc<AtomicBool>,
|
||||
callback: &dyn Fn(AnimeDataBuffer),
|
||||
callback: &dyn Fn(AnimeDataBuffer) -> Result<(), AnimeError>,
|
||||
) -> Result<(), AnimeError> {
|
||||
let mut count = 0;
|
||||
let start = Instant::now();
|
||||
@@ -164,7 +164,7 @@ pub fn run_animation(
|
||||
}
|
||||
}
|
||||
|
||||
callback(output);
|
||||
callback(output)?;
|
||||
|
||||
if timed && Instant::now().duration_since(start) > run_time {
|
||||
break 'animation;
|
||||
|
||||
@@ -12,6 +12,7 @@ pub enum AnimeError {
|
||||
Format,
|
||||
/// The input was incorrect size, expected size is `IncorrectSize(width, height)`
|
||||
IncorrectSize(u32, u32),
|
||||
Dbus(String),
|
||||
}
|
||||
|
||||
impl fmt::Display for AnimeError {
|
||||
@@ -28,6 +29,7 @@ impl fmt::Display for AnimeError {
|
||||
"The input image size is incorrect, expected {}x{}",
|
||||
width, height
|
||||
),
|
||||
AnimeError::Dbus(detail) => write!(f, "{}", detail),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user