Closed nurdism closed 1 year ago
Hi @nurdism
Could you please provide an example, when the code or type is empty?
I am unsure about getErrorCode()
because I couldn't find much documentation on exactly what comes back in the response, added it to be safer. But as far as getErrorType()
429 - You exceeded your current quota, please check your plan and billing details
does not have a type and will throw a type error when attempting to use getErrorType()
@nurdism Than I suggest to only make the type nullable. Can you please adjust your PR?
Oh, I just saw that in another issue we have an error response where the code is null: https://github.com/openai-php/client/pull/89#discussion_r1148437425
So both should be nullable.
Please add some tests as @nunomaduro mentioned above and then the PR should be ready. If you have troubles doing so, please let me know.
I don't even know where to begin to write a test for this, feel free to close this and submit a different PR
Okay, no worries. I will do it later this week.
Finally found time to fix this https://github.com/openai-php/client/pull/102
ErrorException
will throw aTypeError
when attempting to usegetErrorCode()
orgetErrorType()
if they are null, this RP makes those function return nullable strings