Skip to content

handle parsing for error when chunked #591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

stevenou
Copy link

@stevenou stevenou commented May 9, 2025

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?

So I based this off of #480 which seems like it might be abandoned at this point. I copy-pasted the spec minus a minor fix for splitting the json into 2 chunks (it was missing a character in the 2nd chunk).

The approach taken here assumes the error is parsable json. We accumulate the chunks until the message is parsable, then we raise an error. I don't really know enough about SSE/streaming to know whether this is definitely a bad idea but none of the existing specs broke so I'm hoping it's acceptable.

Not sure what would happen if, let's say, the stream disconnects midway so we never get the completed error message. I'm guessing in that case a different type of error (related to connection/streaming) will surface instead of the original error, which is probably ok?

Or if the error is never parsable - then possibly the whole thing fails silently?

Let me know your thoughts please.

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