From ede680ee00e602e1a4f93a0b01c4940057cc4823 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 13 Mar 2023 20:00:38 +0100 Subject: [PATCH] [Command] Print parse error and return default --- src/command.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/command.rs b/src/command.rs index e2716ce..0ecf08b 100644 --- a/src/command.rs +++ b/src/command.rs @@ -22,7 +22,13 @@ impl Into for Command { impl From<&str> for Command { 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() + } + } } }