Skip to content

Commit

Permalink
refactor WrapError
Browse files Browse the repository at this point in the history
  • Loading branch information
quartzmo committed Nov 3, 2022
1 parent 9c1f9fe commit 40cbb9b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/gensupport/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ import (
// (or a [google.golang.org/grpc/status.Status]), it returns err without
// modification.
func WrapError(err error) error {
if apiError, ok := apierror.ParseError(err, false); ok {
var herr *googleapi.Error
if errors.As(err, &herr) {
herr.Err = apiError
}
apiError, ok := apierror.ParseError(err, false)
var herr *googleapi.Error
if ok && errors.As(err, &herr) {
herr.Err = apiError
}
return err
}

0 comments on commit 40cbb9b

Please sign in to comment.