[Command] Print parse error and return default
This commit is contained in:
parent
766b20a5c0
commit
ede680ee00
1 changed files with 7 additions and 1 deletions
|
@ -22,7 +22,13 @@ impl Into<std::process::Command> for Command {
|
||||||
|
|
||||||
impl From<&str> for Command {
|
impl From<&str> for Command {
|
||||||
fn from(value: &str) -> Self {
|
fn from(value: &str) -> Self {
|
||||||
serde_json::from_str(value).unwrap_or_default()
|
match serde_json::from_str(value) {
|
||||||
|
Ok(command) => command,
|
||||||
|
Err(e) => {
|
||||||
|
eprintln!("[ERROR] {e}");
|
||||||
|
Command::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue