Skip to main content

json_parse_context

Function json_parse_context 

Source
pub(super) fn json_parse_context(label: &str, payload: &str) -> String
Expand description

Builds the anyhow context for a failed serde_json parse of a fetched payload.

A bare serde message (“expected value at line 1 column 1”) throws away the only evidence that matters: what the fetch actually wrote. The scheduled monitor failed opaquely for weeks because of it - the real payload was ANSI-colorized JSON, which is indistinguishable from “empty file” or “API error object” once the bytes are discarded. Report the size, a diagnosis when the payload has a recognizable shape, and an escaped head.