Closed ledmonster closed 1 year ago
It seems that I misunderstood. call.Do()
doesn't return googleapi.Error
. It returns custom error generated here.
But I think it's still confusing.
Thank you for taking the time to open this ticket.
I'd like to clarify a couple of things about your request:
Did this test previously work with Google's iot core sdk, but now fails when using ClearBlade's sdk?
following test works with Google's iot core sdk (google.golang.org/api v0.107.0
).
call := c.iot.Projects.Locations.Registries.Devices.Get(c.devicePath(deviceID)).Context(c.ctx)
_, err := call.Do()
e, ok := err.(*googleapi.Error)
if !ok {
t.Fatal("expect googleapi.Error type")
}
call.Do()
returns googleapi.Error
. (not apierror.APIError
).
On the other hand, clearblade implementation returns errors.New(..)
object.
Are you requesting a specific change to the call.Do() error response or an improvement to our documentation about errors?
I request two things.
google.golang.org/api/googleapi
or github.com/clearblade/go-iot/cblib/googleapi
. Please don't use both.call.Do()
to return googleapi.Error
object, which has much more detail than normal errors.New(..)
object.Thank you for the clarifications. I'll keep you updated on the progress of these changes.
@ledmonster I have opened this PR to hopefully resolve your issue: https://github.com/ClearBlade/go-iot/pull/16
You can install this change to your project using the command: go get github.com/clearblade/go-iot@1073122042397cac3d11cd104739dfcecfc7b333
Would you please verify that this change works as you are expecting?
@andrewhdev it works fine, thank you!!
While
iot.go
usescblib.gensupport
usesBecause of this problem, gensupports'
WrapError
doesn't returnapierror.APIError
. Following test faiils.Please use either of these two module.