Skip to content

fix: preserve non-object response error bodies#690

Open
lin-hongkuan wants to merge 1 commit into
ollama:mainfrom
lin-hongkuan:codex/response-error-json-nonobject
Open

fix: preserve non-object response error bodies#690
lin-hongkuan wants to merge 1 commit into
ollama:mainfrom
lin-hongkuan:codex/response-error-json-nonobject

Conversation

@lin-hongkuan

Copy link
Copy Markdown

Summary

  • Only read the error field from JSON object error responses.
  • Preserve non-object JSON error bodies instead of raising a constructor-time exception.

Why

ResponseError currently assumes any decoded JSON response is a dictionary. JSON strings, arrays, or numbers are valid response bodies and should still produce a useful ResponseError.

Testing

  • python -m pytest tests/test_type_serialization.py::test_response_error_uses_json_object_error_field tests/test_type_serialization.py::test_response_error_preserves_non_object_json_body -q
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant