You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I’ve been working with your Go SDK and I’ve enjoyed digging around to see how the generator works.
I’ve seen various discussions about decoding error responses as per the Swagger API spec, specifically #795 (comment) and I’d like to suggest one way of achieving this using the autogenerated models.
I have a PR of this implementation which I’d be interested to get your thoughts on. resolutionlife#5
As well as this, I need to access the specific status of the error response. This could be done through wrapping the error message in a well defined error type. For example see the below.
if err != nil {
if errors.Is(err, v4.ErrNotFound) {
…
}
return err
}
where v4.ErrNotFound is defined like so
var ErrNotFound = errors.New("not found")
This feature is also covered in my PR against a forked repo.
What are your thoughts on this approach to decoding the error responses?
The text was updated successfully, but these errors were encountered:
Hello, I’ve been working with your Go SDK and I’ve enjoyed digging around to see how the generator works.
I’ve seen various discussions about decoding error responses as per the Swagger API spec, specifically #795 (comment) and I’d like to suggest one way of achieving this using the autogenerated models.
As the error models are defined in the
v4
package, thertl
package cannot import the models as this would lead to a cyclic dependancy. This means theDo
method https://github.com/looker-open-source/sdk-codegen/blob/main/go/rtl/auth.go#L89 must expose the error status and the body so the body can be decoded in thev4
package.I have a PR of this implementation which I’d be interested to get your thoughts on. resolutionlife#5
As well as this, I need to access the specific status of the error response. This could be done through wrapping the error message in a well defined error type. For example see the below.
where v4.ErrNotFound is defined like so
This feature is also covered in my PR against a forked repo.
What are your thoughts on this approach to decoding the error responses?
The text was updated successfully, but these errors were encountered: