Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Improve error handling and logging in renderer

Richie McIlroy8f71c7dddb7b
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 200775522..012869016 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -46,7 +46,6 @@ impl Renderer {
)?);
let mut max_duration = recordings.duration();
- // Check camera duration if it exists
if let Some(camera_path) = meta.camera_path()
&& let Ok(camera_duration) =
recordings.get_source_duration(&recording_meta.path(&camera_path))
@@ -143,7 +142,7 @@ impl Renderer {
break;
}
}
- let frame = frame_renderer
+ match frame_renderer
.render(
current.segment_frames,
current.uniforms,
@@ -151,8 +150,14 @@ impl Renderer {
&mut layers,
)
.await
- .unwrap();
- (self.frame_cb)(frame);
+ {
+ Ok(frame) => {
+ (self.frame_cb)(frame);
+ }
+ Err(e) => {
+ tracing::error!(error = %e, "Failed to render frame in editor");
+ }
+ }
let _ = current.finished.send(());
}
@@ -182,7 +187,6 @@ impl RendererHandle {
}
pub async fn stop(&self) {
- // Send a stop message to the renderer
let (tx, rx) = oneshot::channel();
if self
.tx
@@ -190,9 +194,8 @@ impl RendererHandle {
.await
.is_err()
{
- println!("Failed to send stop message to renderer");
+ tracing::warn!("Failed to send stop message to renderer");
}
- // Wait for the renderer to acknowledge the stop
let _ = rx.await;
}
}