Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Capture errors within render_to_file specifically

Ilyaa269d405e5de
diff --git a/Cargo.lock b/Cargo.lock
index b6039a40d..23f933916 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -774,7 +774,6 @@ dependencies = [
"cap-utils",
"image 0.25.2",
"mp4",
- "sentry",
"tempfile",
"tokio",
]
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs
index a981f94aa..520a7484b 100644
--- a/apps/desktop/src-tauri/src/lib.rs
+++ b/apps/desktop/src-tauri/src/lib.rs
@@ -1085,6 +1085,10 @@ async fn render_to_file(
project: ProjectConfiguration,
progress_channel: tauri::ipc::Channel<RenderProgress>,
) {
+ sentry::configure_scope(|scope| {
+ scope.set_tag("cmd", "render_to_file");
+ });
+
let (duration, _size) =
get_video_metadata(app.clone(), video_id.clone(), Some(VideoType::Screen))
.await
@@ -1095,7 +1099,7 @@ async fn render_to_file(
let editor_instance = upsert_editor_instance(&app, video_id.clone()).await;
- cap_export::export_video_to_file(
+ let export_result = cap_export::export_video_to_file(
project,
output_path,
move |current_frame| {
@@ -1114,8 +1118,10 @@ async fn render_to_file(
editor_instance.render_constants.clone(),
editor_instance.cursor.clone(),
)
- .await
- .ok();
+ .await;
+ if let Err(err) = export_result {
+ sentry::capture_message(&err, sentry::Level::Error);
+ }
ShowCapturesPanel.emit(&app).ok();
}
diff --git a/crates/editor/src/editor_instance.rs b/crates/editor/src/editor_instance.rs
index 7276c13ac..7776790ea 100644
--- a/crates/editor/src/editor_instance.rs
+++ b/crates/editor/src/editor_instance.rs
@@ -38,7 +38,7 @@ impl EditorInstance {
on_state_change: impl Fn(&EditorState) + Send + Sync + 'static,
) -> Arc<Self> {
sentry::configure_scope(|scope| {
- scope.set_tag("window", "editor");
+ scope.set_tag("crate", "editor");
});
let project_path = projects_path.join(format!(
diff --git a/crates/export/Cargo.toml b/crates/export/Cargo.toml
index 738483031..2b18bd36e 100644
--- a/crates/export/Cargo.toml
+++ b/crates/export/Cargo.toml
@@ -13,7 +13,6 @@ cap-media = { path = "../media" }
cap-flags = { path = "../flags" }
tokio.workspace = true
-sentry.workspace = true
tempfile = "3.12.0"
image = "0.25.2"
mp4 = "0.14.0"
diff --git a/crates/export/src/lib.rs b/crates/export/src/lib.rs
index 2de73c2a6..f6b40935a 100644
--- a/crates/export/src/lib.rs
+++ b/crates/export/src/lib.rs
@@ -23,10 +23,6 @@ pub async fn export_video_to_file(
render_constants: Arc<RenderVideoConstants>,
cursor: Arc<CursorData>,
) -> Result<PathBuf, String> {
- sentry::configure_scope(|scope| {
- scope.set_tag("task", "export_video_to_file");
- });
-
let (tx_image_data, mut rx_image_data) = tokio::sync::mpsc::channel::<Vec<u8>>(4);
let output_folder = output_path.parent().unwrap();