Explorar o código

fix(plugin): improve error for missing `links` property (#9632)

* Better error

* Improve errors
Oscar Beaumont hai 1 ano
pai
achega
bf2635ab62

+ 6 - 0
.changes/improve-errors-for-missing-links-property.md

@@ -0,0 +1,6 @@
+---
+'tauri-plugin': patch:enhance
+---
+
+Improve the error message that is shown when the `links` property is missing from a Tauri Plugin.
+

+ 1 - 1
core/tauri-plugin/src/build/mod.rs

@@ -97,7 +97,7 @@ impl<'a> Builder<'a> {
     let out_dir = PathBuf::from(build_var("OUT_DIR")?);
 
     // requirement: links MUST be set and MUST match the name
-    let _links = build_var("CARGO_MANIFEST_LINKS")?;
+    let _links = std::env::var("CARGO_MANIFEST_LINKS").map_err(|_| Error::LinksMissing)?;
 
     let autogenerated = Path::new("permissions").join(acl::build::AUTOGENERATED_FOLDER_NAME);
     let commands_dir = autogenerated.join("commands");