Selaa lähdekoodia

fix(cli/icon): return with an error instead of panic (#9638)

* fix(cli/icon): return with an error instead of panic

closes #9636

* Update .changes/cli-icon-non-0-exit.md
Amr Bashir 1 vuosi sitten
vanhempi
sitoutus
97ec422f22
2 muutettua tiedostoa jossa 8 lisäystä ja 2 poistoa
  1. 6 0
      .changes/cli-icon-non-0-exit.md
  2. 2 2
      tooling/cli/src/icon.rs

+ 6 - 0
.changes/cli-icon-non-0-exit.md

@@ -0,0 +1,6 @@
+---
+"tauri-cli": "patch:bug"
+"@tauri-apps/cli": "patch:bug"
+---
+
+Exit `tauri icon` with non-zero code when it fails.

+ 2 - 2
tooling/cli/src/icon.rs

@@ -138,11 +138,11 @@ pub fn command(options: Options) -> Result<()> {
       ))
     }
   } else {
-    panic!("Error loading image");
+    anyhow::bail!("Error loading image");
   };
 
   if source.height() != source.width() {
-    panic!("Source image must be square");
+    anyhow::bail!("Source image must be square");
   }
 
   if png_icon_sizes.is_empty() {