Skip to content

String errors#452

Closed
moldhouse wants to merge 2 commits into
64bit:mainfrom
moldhouse:string-errors
Closed

String errors#452
moldhouse wants to merge 2 commits into
64bit:mainfrom
moldhouse:string-errors

Conversation

@moldhouse
Copy link
Copy Markdown
Contributor

References #448

In the issue, the idea of exposing a serde_json::Value was discussed. In some internal server error cases, even OpenAI does return error messages that are not json. This made me wonder if representing the error as String might give users more flexibility. Would be eager to get some feedback if this matches what you had in mind @64bit

I'm uncertain if the second commit (offering a helper method to parse the raw string into a type) provides value / goes beyond the scope of this library, happy to remove it.

…ormat

the error format of different providers sometimes diverges from OpenAI.
the string-error feature does not try to parse errors into the OpenAI
format, but leaves it up to the user. when enabled, the  is
a wrapper around the original error message. This also enables cases
where the error message is not even valid json
@64bit
Copy link
Copy Markdown
Owner

64bit commented May 7, 2026

Thanks again for this - this is now supported for any custom error types via https://docs.rs/async-openai/latest/async_openai/error/enum.OpenAIError.html#variant.Boxed

Hence closing.

@64bit 64bit closed this May 7, 2026
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.

2 participants