From 42fbfb4091df3fad3b79ee572373db20ceddfe02 Mon Sep 17 00:00:00 2001 From: "Jorge C. Leitao" Date: Sat, 23 Jul 2022 05:58:03 +0000 Subject: [PATCH] Improved error message --- src/array/specification.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/array/specification.rs b/src/array/specification.rs index 8c35194f96b..2b189b76afc 100644 --- a/src/array/specification.rs +++ b/src/array/specification.rs @@ -99,14 +99,14 @@ pub fn try_check_offsets(offsets: &[O], values_len: usize) -> Result< pub fn check_indexes(keys: &[K], len: usize) -> Result<()> where - K: Copy + TryInto, + K: std::fmt::Debug + Copy + TryInto, { keys.iter().try_for_each(|key| { let key: usize = (*key) .try_into() - .map_err(|_| Error::oos("The dictionary key must fit in a `usize`"))?; + .map_err(|_| Error::oos(format!("The dictionary key must fit in a `usize`, but {:?} does not", key)))?; if key >= len { - Err(Error::oos("The dictionary key must be smaller")) + Err(Error::oos(format!("One of the dictionary keys is {} but it must be < than the length of the dictionary values, which is {}", key, len))) } else { Ok(()) }