Skip to content

Commit f1d6fed

Browse files
authored
Merge pull request #129 from alicelyu-px/volumeStateCheck
improvement to error handling
2 parents 234325f + 68add50 commit f1d6fed

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

aws/aws.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,12 @@ func (s *awsOps) AreVolumesReadyToExpand(volumeIDs []*string) (bool, error) {
957957
if isErrorModificationNotFound(err) {
958958
return true, nil
959959
}
960-
return false, fmt.Errorf("unable to get modification states for aws volumes: %v", err)
960+
// in the case of getting unclassified request failure, result of this checker may be bypassed
961+
// to not block volume resize operation.
962+
return false, &cloudops.ErrCloudProviderRequestFailure{
963+
Request: "DescribeVolumesModifications",
964+
Message: err.Error(),
965+
}
961966
}
962967
states := describeOutput.VolumesModifications
963968

errors.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,15 @@ type ErrCurrentCapacityHigherThanDesired struct {
112112
func (e *ErrCurrentCapacityHigherThanDesired) Error() string {
113113
return fmt.Sprintf("current capacity (%d) is higher than desired capacity: %d", e.Current, e.Desired)
114114
}
115+
116+
// ErrCloudProviderRequestFailure is returned when an unknown API request failure occurred.
117+
type ErrCloudProviderRequestFailure struct {
118+
// Request is the API function name
119+
Request string
120+
// Message is the error message returned by the cloud provider
121+
Message string
122+
}
123+
124+
func (e *ErrCloudProviderRequestFailure) Error() string {
125+
return fmt.Sprintf("Request %s returns %s", e.Request, e.Message)
126+
}

0 commit comments

Comments
 (0)