Skip to content

apierror.Error has empty Message and Code for downstream 404 errors #644

@CarstenLeue

Description

@CarstenLeue

If the LLM URL is incorrect and the server responds with a 404 then the SDK produces an apierror.Error with empty Message and Code:

https://github.com/openai/openai-[go/blob/main/internal/requestconfig/requestconfig.go#L512](https://www.golinks.io/blob/main/internal/requestconfig/requestconfig.go#L512?trackSource=github)

When such an error gets serialized downstream, it shows an error object with empty fields, which is not very helpful.
I suggest to handle this more gracefully and populate the Code field with e.g. unknown_url and a message explaining the cause.

Else, how would an application handle this situation? Does it make sense to expose an apierror.Error in the first place?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions