diff --git a/core/tauri/src/command.rs b/core/tauri/src/command.rs index b5122a19f..2750be494 100644 --- a/core/tauri/src/command.rs +++ b/core/tauri/src/command.rs @@ -50,8 +50,9 @@ pub trait CommandArg<'de, R: Runtime>: Sized { /// Automatically implement [`CommandArg`] for any type that can be deserialized. impl<'de, D: Deserialize<'de>, R: Runtime> CommandArg<'de, R> for D { fn from_command(command: CommandItem<'de, R>) -> Result { + let name = command.name; let arg = command.key; - Self::deserialize(command).map_err(|e| crate::Error::InvalidArgs(arg, e).into()) + Self::deserialize(command).map_err(|e| crate::Error::InvalidArgs(name, arg, e).into()) } } diff --git a/core/tauri/src/error.rs b/core/tauri/src/error.rs index 8ee0c913d..defd9e859 100644 --- a/core/tauri/src/error.rs +++ b/core/tauri/src/error.rs @@ -58,8 +58,8 @@ pub enum Error { #[error("'{0}' not on the allowlist (https://tauri.studio/docs/api/config#tauri.allowlist)")] ApiNotAllowlisted(String), /// Invalid args when running a command. - #[error("invalid args for command `{0}`: {1}")] - InvalidArgs(&'static str, serde_json::Error), + #[error("invalid args `{1}` for command `{0}`: {2}")] + InvalidArgs(&'static str, &'static str, serde_json::Error), /// Encountered an error in the setup hook, #[error("error encountered during setup hook: {0}")] Setup(Box),