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_lencharacters.