Skip to content

Commit

Permalink
Refactor(OpenAIGenerator): Error handling
Browse files Browse the repository at this point in the history
- Check for error response in JSON
- Handle error response
  • Loading branch information
guanguans committed Aug 18, 2023
1 parent 153a918 commit c4dec79
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
],
JsonThrowOnErrorRector::class => [
__DIR__.'/app/Generators/OpenAIGenerator.php',
__DIR__.'/app/Generators/ErnieBotGenerator.php',
],
StaticClosureRector::class => [
__DIR__.'/tests',
Expand Down
2 changes: 1 addition & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function setup_http_fake(): void
break;
case 'invalid':
$text = <<<'json'
[{"id":1,"subject":"Fix(OpenAIGenerator): Debugging output","body":"- Add var_dump() for debugging output- Add var_dump() for stream response"},{"id":2,"subject":"Refactor(OpenAIGenerator): Error handling","body":"- Check for error response in JSON- Handle error response"},{"id":3,"subject":"Docs(OpenAIGenerator): Update documentation","body":"- Update documentation for OpenAIGenerator class"}]
[{id":1,"subject":"Fix(OpenAIGenerator): Debugging output","body":"- Add var_dump() for debugging output- Add var_dump() for stream response"},{"id":2,"subject":"Refactor(OpenAIGenerator): Error handling","body":"- Check for error response in JSON- Handle error response"},{"id":3,"subject":"Docs(OpenAIGenerator): Update documentation","body":"- Update documentation for OpenAIGenerator class"}]
json;

break;
Expand Down

0 comments on commit c4dec79

Please sign in to comment.