mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
fix: InvalidArgs error message should include the command name (#3433)
This commit is contained in:
@@ -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<Self, InvokeError> {
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<dyn std::error::Error + Send>),
|
||||
|
||||
Reference in New Issue
Block a user