8000 why createStream silently ignored the potenital json decode error ? · Issue #190 · anasfik/openai · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
why createStream silently ignored the potenital json decode error ? #190
Open
@JunYang-tes

Description

@JunYang-tes

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);
                }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0