Improve error messages

This commit is contained in:
bells17
2020-02-20 01:09:40 +09:00
parent 0a1579d0f2
commit dd390a3e38

View File

@@ -260,21 +260,21 @@ func (ctrl *csiSnapshotSideCarController) checkandUpdateContentStatusOperation(c
if content.Spec.VolumeSnapshotClassName != nil {
class, err := ctrl.getSnapshotClass(*content.Spec.VolumeSnapshotClassName)
if err != nil {
klog.Errorf("Failed to getSnapshotClass %s", err)
return nil, fmt.Errorf("cannot get snapshot class %s for snapshot content %s", *content.Spec.VolumeSnapshotClassName, err)
klog.Errorf("Failed to get snapshot class %s for snapshot content %s", *content.Spec.VolumeSnapshotClassName, err)
return nil, fmt.Errorf("failed to get snapshot class %s for snapshot content %s", *content.Spec.VolumeSnapshotClassName, err)
}
snapshotterListSecretRef, err := utils.GetSecretReference(utils.SnapshotterListSecretParams, class.Parameters, content.GetObjectMeta().GetName(), nil)
if err != nil {
klog.Errorf("Failed to get secret reference for snapshot %s: %s", content.Name, err.Error())
return nil, fmt.Errorf("cannot get secret reference for snapshot content %#v", content.Name)
klog.Errorf("Failed to get secret reference for snapshot %s: %s", content.Name, err)
return nil, fmt.Errorf("failed to get secret reference for snapshot %s: %s", content.Name, err)
}
snapshotterListCredentials, err = utils.GetCredentials(ctrl.client, snapshotterListSecretRef)
if err != nil {
// Continue with deletion, as the secret may have already been deleted.
klog.Errorf("Failed to get credentials for snapshot %s: %s", content.Name, err.Error())
return nil, fmt.Errorf("cannot get credentials for snapshot content %#v", content.Name)
klog.Errorf("Failed to get credentials for snapshot %s: %s", content.Name, err)
return nil, fmt.Errorf("failed to get credentials for snapshot %s: %s", content.Name, err)
}
}