Skip to content
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

why createStream silently ignored the potenital json decode error ? #190

Open
JunYang-tes opened this issue Aug 21, 2024 · 0 comments
Open

Comments

@JunYang-tes
Copy link

Hi,

I'm wondering why this potienital json decode be ignored:

try {
decodedData = decodeToMap(respondData);
} catch (error) {/** ignore, data has not been received */}

I'm using a Microsoft Azure provided openai services behand a cloudflare worker. when I misspelled the model name, I got a 403 response which body is not a valid json. In this case,I am unable to get either the data or the error message.

Is it possible to change here to this:

                try {
                  decodedData = decodeToMap(respondData);
                } catch (error) {
                  final statusCode = respond.statusCode;
                  final exception = RequestFailedException(error.toString(), statusCode);
                  yield* Stream<T>.error(exception);
                }

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

No branches or pull requests

1 participant