Handle OpenAI API errors in processChatResult#540
Merged
ilvalerione merged 5 commits intoneuron-core:3.xfrom Apr 14, 2026
Merged
Handle OpenAI API errors in processChatResult#540ilvalerione merged 5 commits intoneuron-core:3.xfrom
ilvalerione merged 5 commits intoneuron-core:3.xfrom
Conversation
Contributor
|
the "empty output" is not necessary on error. I don't think it should raise an exception. It could depends by the stop reason for example. |
Contributor
Author
|
@ilvalerione As I’m not too familiar with the response structure, I have updated the checks to include only what is necessary for the existing Alternatively, would it be better to use the null coalescing operator ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds improved error handling to the
processChatResultmethod insrc/Providers/OpenAI/Responses/HandleChat.php. The main change is to ensure that errors returned from the OpenAI API are detected and reported clearly, making debugging and maintenance easier.Error handling improvements:
'error'key in the$resultarray, throwing aProviderExceptionwith the error message if present.'output'key exists in the$resultarray, throwing aProviderExceptionif it is missing.