-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
APIError.Error() doesn't unwrap error correctly #389
Comments
@leventov Thank you for reporting this issue. Can you provide a log statement with the error, and the JSON? Any more info that you can provide will be helpful, thank you. |
httpErr.Body was exactly this:
Note slight variation from the shape reported in google-gemini/generative-ai-python#463, where it's an object on the top level with "error" field. But in my case, it is additional array wrapping on top. |
Also FYI, the root cause of the error was that I didn't provide api key but because Regardless, I'm not sure the failure the failure of |
|
|
Did gax-go throw an error, or did it just return an error cleanly but with an empty message? |
It returned error with 403 code but no message. All I'm asking for is for code to try harder to propagate the error up so that debugging is easier. Well, it wasn't also that hard for me, I had to debug the code and set the breakpoint at line 208 here to investigate, but it's not supposed to be required, right? And maybe in some other environments or cross-process proxying settings debugging might me much harder. Edit: by "no message" I mean that the error message was "googleapi: Error 403: ". |
I understand that you are only interested in getting the message. We are also interested in the root cause of the missing message, which is why I need to ask these questions. |
Environment details
Code: https://github.com/googleapis/gax-go/blob/dc6baf75c1a737233739630b5af6c9759f08abcd/v2/apierror/apierror.go#L202C1-L208C82
Error from
POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:streamGenerateContent?%24alt=json%3Benum-encoding%3Dint
httpErr.Message is empty, but httpErr.Body is not empty and contains a JSON list with a single object which has "message" field.
The text was updated successfully, but these errors were encountered: