Skip to content

Conversation

@longseespace
Copy link
Contributor

Problem

The streaming methods (fetchStream and fetchAssistantStreamEvents) don't decode OpenAI error responses, only returning generic "status code X" messages instead of detailed error information.

Solution

Apply the same OpenAI error decoding logic from the working fetch method to both streaming methods.

Note

This PRs also modifies the errorMessage to keep the original error message from API server, giving application full control over how to construct the final error message. Rationale: I think at library-level, we should not modify the error message from remote API server. This would make it very difficult at the app-level to offer good error reporting UX.

@jamesrochabrun
Copy link
Owner

thanks for the contribution! please run the swift format linter.

@jamesrochabrun jamesrochabrun merged commit b4956db into jamesrochabrun:main Aug 2, 2025
2 of 3 checks passed
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.

2 participants