Przeglądaj źródła

fix(core): better error when deserializing plugin config (#9631)

* Better error for errors decoding plugin config

* changes
Oscar Beaumont 1 rok temu
rodzic
commit
7f6d2698c9

+ 5 - 0
.changes/better-error-for-invalid-plugin-config.md

@@ -0,0 +1,5 @@
+---
+'tauri': patch:enhance
+---
+
+Improve the error message that is shown when deserializing the Tauri plugin config.

+ 6 - 1
core/tauri/src/plugin.rs

@@ -677,7 +677,12 @@ impl<R: Runtime, C: DeserializeOwned> Plugin<R> for TauriPlugin<R, C> {
           name: self.name,
           handle: app.clone(),
           raw_config: Arc::new(config.clone()),
-          config: serde_json::from_value(config)?,
+          config: serde_json::from_value(config).map_err(|err| {
+            format!(
+              "Error deserializing 'plugins.{}' within your Tauri configuration: {err}",
+              self.name
+            )
+          })?,
         },
       )?;
     }