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

* Better error for errors decoding plugin config

* changes
This commit is contained in:
Oscar Beaumont 2024-05-02 05:44:40 +08:00 committed by GitHub
parent 8a71858eb2
commit 7f6d2698c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

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

View File

@ -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
)
})?,
},
)?;
}