Skip to main content

Module error_sanitizer

Module error_sanitizer 

Source
Expand description

Helpers for sanitizing upstream error payloads before surfacing them. Error message sanitization helpers for AI service clients.

These helpers prevent leaking sensitive information (overly long error bodies, URL query strings that may contain API keys or tokens) into user-facing error messages.

Constants§

DEFAULT_ERROR_BODY_MAX_LEN
Maximum number of characters preserved from an upstream error body.

Functions§

sanitize_url_in_error
Strip query parameters from any URLs appearing in an error message.
truncate_error_body
Truncate an error response body to at most max_len characters.