Browse Source

feat(bundler): enhance notarization error message (#7974)

Lucas Fernandes Nogueira 1 year ago
parent
commit
3880b42d18

+ 5 - 0
.changes/improve-notarytool-error-message.md

@@ -0,0 +1,5 @@
+---
+"tauri-bundler": patch:enhance
+---
+
+Include notarytool log output on error message in case notarization fails.

+ 16 - 1
tooling/bundler/src/bundle/macos/sign.rs

@@ -306,7 +306,22 @@ pub fn notarize(
       staple_app(app_bundle_path)?;
       Ok(())
     } else {
-      Err(anyhow::anyhow!("{log_message}").into())
+      if let Ok(output) = Command::new("xcrun")
+        .args(["notarytool", "log"])
+        .arg(&submit_output.id)
+        .notarytool_args(&auth)
+        .output_ok()
+      {
+        Err(
+          anyhow::anyhow!(
+            "{log_message}\nLog:\n{}",
+            String::from_utf8_lossy(&output.stdout)
+          )
+          .into(),
+        )
+      } else {
+        Err(anyhow::anyhow!("{log_message}").into())
+      }
     }
   } else {
     Err(anyhow::anyhow!("failed to parse notarytool output as JSON: `{output_str}`").into())