@@ -612,7 +612,7 @@ func (gceCS *GCEControllerServer) executeControllerPublishVolume(ctx context.Con
612
612
if gce .IsGCENotFoundError (err ) {
613
613
return nil , status .Errorf (codes .NotFound , "Could not find instance %v: %v" , nodeID , err .Error ()), disk
614
614
}
615
- return nil , status . Errorf ( codes . Internal , "Failed to get instance: %v " , err . Error () ), disk
615
+ return nil , common . LoggedError ( "Failed to get instance: " , err ), disk
616
616
}
617
617
618
618
readWrite := "READ_WRITE"
@@ -647,12 +647,12 @@ func (gceCS *GCEControllerServer) executeControllerPublishVolume(ctx context.Con
647
647
machineType := parseMachineType (instance .MachineType )
648
648
return nil , status .Errorf (codes .InvalidArgument , "'%s' is not a compatible disk type with the machine type %s, please review the GCP online documentation for available persistent disk options" , udErr .DiskType , machineType ), disk
649
649
}
650
- return nil , status . Errorf ( codes . Internal , "Failed to Attach: %v " , err . Error () ), disk
650
+ return nil , common . LoggedError ( "Failed to Attach: " , err ), disk
651
651
}
652
652
653
653
err = gceCS .CloudProvider .WaitForAttach (ctx , project , volKey , instanceZone , instanceName )
654
654
if err != nil {
655
- return nil , status . Errorf ( codes . Internal , "Errored during WaitForAttach: %v " , err . Error () ), disk
655
+ return nil , common . LoggedError ( "Errored during WaitForAttach: " , err ), disk
656
656
}
657
657
658
658
klog .V (4 ).Infof ("ControllerPublishVolume succeeded for disk %v to instance %v" , volKey , nodeID )
@@ -744,7 +744,7 @@ func (gceCS *GCEControllerServer) executeControllerUnpublishVolume(ctx context.C
744
744
klog .Warningf ("Treating volume %v as unpublished because node %v could not be found" , volKey .String (), instanceName )
745
745
return & csi.ControllerUnpublishVolumeResponse {}, nil , diskToUnpublish
746
746
}
747
- return nil , status . Errorf ( codes . Internal , "error getting instance: %v " , err . Error () ), diskToUnpublish
747
+ return nil , common . LoggedError ( "error getting instance: " , err ), diskToUnpublish
748
748
}
749
749
750
750
deviceName , err := common .GetDeviceName (volKey )
@@ -1001,7 +1001,7 @@ func (gceCS *GCEControllerServer) createPDSnapshot(ctx context.Context, project
1001
1001
snapshot , err = gceCS .CloudProvider .GetSnapshot (ctx , project , snapshotName )
1002
1002
if err != nil {
1003
1003
if ! gce .IsGCEError (err , "notFound" ) {
1004
- return nil , status . Errorf ( codes . Internal , "Failed to get snapshot: %v " , err . Error () )
1004
+ return nil , common . LoggedError ( "Failed to get snapshot: " , err )
1005
1005
}
1006
1006
// If we could not find the snapshot, we create a new one
1007
1007
snapshot , err = gceCS .CloudProvider .CreateSnapshot (ctx , project , volKey , snapshotName , snapshotParams )
0 commit comments