Closed Bin-Huang closed 2 months ago
Thanks for the contribution. This will be a breaking API change, which I'm not sure the nature of the PR justifies at this point
In addition to what Eli said, our convention for the function that creates the iterator is not to return an error. You'll find out as soon as you start iterating. There's one less place in the code that checks for errors.
I disagree that this "allows developers to handle these errors more efficiently and write more responsive error-handling code." I think both designs are about the same.
Sorry for the "no" on this, but we are glad that your are thinking of ways to improve the SDK!
This PR modifies SendMessageStream to return errors early for pre-flight checks like API errors and parameter format errors (400 status codes). This change allows developers to handle these errors more efficiently and write more responsive error-handling code. This enhancement is not to replace error checking during the iteration but to provide the ability to address certain errors upfront.
Previous:
Now: