Skip to main content

parse_upstream_error

Function parse_upstream_error 

Source
pub fn parse_upstream_error(body: &str) -> (Option<String>, Option<String>)
Expand description

Best-effort parse of common upstream error JSON shapes: {"error": {"type": "X", "message": "Y"}} (PDL, Stripe, Anthropic) {"type": "X", "message": "Y"} (flat) {"error": "message string"} (xAI, finnhub flat) {"message": "Y"} (generic)

Returns (error_type, error_message) where each is Some when extractable.