This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

🥅 Show notifications and improve error messages

+22 -9
+13 -7
src/video/encoding.rs
··· 42 42 let encoder = self.setup_encoder(output_file.clone())?; 43 43 let encoder_name = encoder.name(); 44 44 45 - let time_taken = self.encode_with(encoder, engine_controller)?; 45 + let result = self.encode_with(encoder, engine_controller); 46 46 47 47 let _ = notify_rust::Notification::new() 48 48 .appname("Shapemaker") 49 - .summary(&format!("{} is ready", &output_file.into().pretty())) 50 - .body(&format!( 51 - "Encoded with {encoder_name} in {}", 52 - time_taken.pretty() 53 - )) 49 + .summary(&match result { 50 + Ok(_) => format!("{} is ready", &output_file.into().pretty()), 51 + Err(_) => format!("{} failed", &output_file.into().pretty()), 52 + }) 53 + .body(&match result { 54 + Err(ref e) => format!("Encoding failed: {e}"), 55 + Ok(time_taken) => format!( 56 + "Encoded with {encoder_name} in {}", 57 + time_taken.pretty() 58 + ), 59 + }) 54 60 .show(); 55 61 56 - Ok(time_taken) 62 + result 57 63 } 58 64 59 65 pub fn encode_with(
+9 -2
src/video/engine.rs
··· 2 2 use crate::SVGRenderable; 3 3 use crate::rendering::svg; 4 4 use crate::ui::{Log, Pretty}; 5 - use anyhow::Result; 5 + use anyhow::{Result, anyhow}; 6 6 use measure_time::debug_time; 7 7 use std::sync::mpsc::SyncSender; 8 8 ··· 141 141 previous_rendered_beat, 142 142 previous_rendered_frame, 143 143 ) { 144 - (hook.render_function)(&mut canvas, &mut context)?; 144 + (hook.render_function)(&mut canvas, &mut context).map_err( 145 + |e| { 146 + anyhow!( 147 + "Could not render frame at {}: {e}", 148 + context.timestamp().pretty() 149 + ) 150 + }, 151 + )?; 145 152 } 146 153 } 147 154