From 7ff222b0ac279823c4fa21fc920dfece932bcc7a Mon Sep 17 00:00:00 2001 From: pravic Date: Wed, 18 Sep 2024 01:32:54 +0300 Subject: [PATCH] fix(cursor): A better error message in `JsonCursor`. Print the source JSON string in the error message. --- src/cursor.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cursor.rs b/src/cursor.rs index 9cf2f326..8eec4a8f 100644 --- a/src/cursor.rs +++ b/src/cursor.rs @@ -174,7 +174,9 @@ impl JsonCursor { Ok(JsonRow::Row(value)) => ControlFlow::Yield(value), Ok(JsonRow::Progress { .. }) => ControlFlow::Skip, // TODO: another reason? - Err(err) => ControlFlow::Err(Error::BadResponse(err.to_string())), + Err(err) => ControlFlow::Err(Error::BadResponse(format!( + "{err} in {line:?}" + ))), } } else { ControlFlow::Err(Error::NotEnoughData)