From f95bd11db2fd75cb74fdf513aec1f1ad1f97edf4 Mon Sep 17 00:00:00 2001 From: "F. Levi" <55688616+flevi29@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:46:05 +0300 Subject: [PATCH] Improve deserr error for unknown values --- meilisearch-types/src/keys.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/meilisearch-types/src/keys.rs b/meilisearch-types/src/keys.rs index bfa48ffcb..ec0ec60a5 100644 --- a/meilisearch-types/src/keys.rs +++ b/meilisearch-types/src/keys.rs @@ -330,8 +330,9 @@ impl Deserr for Action { Some(action) => Ok(action), None => Err(deserr::take_cf_content(E::error::( None, - deserr::ErrorKind::Unexpected { - msg: format!("string must be a valid action, got {}", s), + deserr::ErrorKind::UnknownValue { + value: &s, + accepted: &Self::SERDE_MAP_ARR.map(|(ser_action, _)| ser_action), }, location, ))),