Skip to content

Commit

Permalink
Merge pull request kubernetes#5095 from x13n/patch-3
Browse files Browse the repository at this point in the history
Fix error logging when waiting for GCE operation
  • Loading branch information
k8s-ci-robot authored Aug 16, 2022
2 parents 3f27f6f + b6e3d56 commit 668d94f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ func (client *autoscalingGceClientV1) waitForOp(operation *gce.Operation, projec
klog.V(4).Infof("Operation %s %s %s status: %s", project, zone, operation.Name, op.Status)
if op.Status == "DONE" {
if op.Error != nil {
return fmt.Errorf("error while getting operation %s on %s: %v", operation.Name, operation.TargetLink, err)
errBytes, err := op.Error.MarshalJSON()
if err != nil {
errBytes = []byte(fmt.Sprintf("operation failed, but error couldn't be recovered: %v", err))
}
return fmt.Errorf("error while getting operation %s on %s: %v", operation.Name, operation.TargetLink, errBytes)
}

return nil
Expand Down

0 comments on commit 668d94f

Please sign in to comment.