litellm/tests/unit/llms/anthropic/chat
izzybn 050aec309f
fix(exceptions): keep the provider error body on e.response for SDK callers (#53587)
* fix(sdk): keep the provider error body on e.response for Responses and shared handler errors

SDK callers who caught a litellm exception got an empty e.response, so e.response.text was '' and e.response.json() raised JSONDecodeError

The exception now carries the provider's status, body, and charset. Its headers and request stay as they were, so proxy replies and retry behavior do not change, and the outbound credentials are never attached

* fix(exceptions): keep the reported status when attaching the provider reply

* fix(exceptions): keep mapped errors for text status codes and attach provider replies on post-response status checks

* fix(vector_stores): keep the provider reply body when a provider config raises a litellm exception

* fix(files): keep the provider reply body on file content download errors

* fix(search): keep the provider reply body on search errors, and give it the exception's status when it had no response

* fix(exceptions): give a remapped error's provider reply the remapped status

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-23 07:23:53 +00:00
..
guardrail_translation fix(anthropic): skip a stream data line that is not a JSON object (#53393) 2026-11-22 22:54:02 +00:00
__init__.py
conftest.py
test_anthropic_chat_handler.py fix(exceptions): keep the provider error body on e.response for SDK callers (#53587) 2026-11-23 07:23:53 +00:00
test_anthropic_chat_transformation.py fix(anthropic)!: send extra_body fields at the top level of the Messages request (#48373) 2026-11-20 06:52:56 -08:00
test_code_interpreter_results_extraction.py feat(anthropic): workload identity federation and pluggable identity sources (#44448) 2026-10-03 17:08:30 -07:00
test_transformation.py test: move whole-unit legacy test files into tests/unit and delete dead skips (#44807) 2026-10-07 05:02:28 +00:00