func (iter *GenerateContentResponseIterator) Next() (*GenerateContentResponse, error) doesn't return the full error
yfzhou0904 opened this issue · 2 comments
yfzhou0904 commented
I'm using Gemini Pro model to generate chat messages. When iter.Next() returns an error, only part of the error string is included, e.g. "googleapi: Error 400:". How can I see the full message?
jba commented
The error comes from a lower-level client. Here is some general information on inspecting the errors.
In this particular case, I found that this code worked well:
import "google.golang.org/api/googleapi"
...
var gerr *googleapi.Error
if errors.As(err, &gerr) {
fmt.Println(gerr)
}
yfzhou0904 commented
The error comes from a lower-level client. Here is some general information on inspecting the errors. In this particular case, I found that this code worked well:
import "google.golang.org/api/googleapi" ... var gerr *googleapi.Error if errors.As(err, &gerr) { fmt.Println(gerr) }
Thanks!