Skip to main content

humanize_api_error

Function humanize_api_error 

Source
pub fn humanize_api_error(status: u16, body: &str) -> String
Expand description

Translate an Anthropic API error response into a human-actionable message.

SECURITY (spec ยง5.1): the response body โ€” including any nested error.message / error.type โ€” is UNTRUSTED. A hostile or misconfigured provider can echo the entire request (prompts, system text, tool schemas, credentials) inside it, so no body-derived text is ever reproduced in the returned message. The body is used only for classification (matching against fixed, vetted patterns); output is built exclusively from static guidance plus the numeric status.