Skip to main content

json_error_summary

Function json_error_summary 

Source
pub fn json_error_summary(error: &Error) -> String
Expand description

Describes a JSON decoding error by its class and position, without the text it quotes.

A serde_json data error quotes the offending value, such as invalid type: string "...", and a provider response carries generated text and tool arguments, so an error message about an undecodable response uses this description instead.

ยงExample

use adk_core::json_error_summary;

let error = serde_json::from_str::<u32>(r#""acct-7731""#).unwrap_err();
assert_eq!(json_error_summary(&error), "schema error at line 1 column 11");