From 2ca575b99d56584bdc904d3671878b28837f3aa4 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 6 Aug 2019 15:24:53 +0530 Subject: [PATCH] Wrap error if failed to fetch mon This will help user to check whats the actual error. if the config file is having issue or the clusterid is not valid. Signed-off-by: Madhu Rajanna --- pkg/cephfs/volumeoptions.go | 2 +- pkg/rbd/rbd_util.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cephfs/volumeoptions.go b/pkg/cephfs/volumeoptions.go index 670c76141..9d20f7d5a 100644 --- a/pkg/cephfs/volumeoptions.go +++ b/pkg/cephfs/volumeoptions.go @@ -114,7 +114,7 @@ func getMonsAndClusterID(options map[string]string) (string, string, error) { monitors, err := util.Mons(csiConfigFile, clusterID) if err != nil { - err = fmt.Errorf("failed to fetch monitor list using clusterID (%s)", clusterID) + err = errors.Wrapf(err, "failed to fetch monitor list using clusterID (%s)", clusterID) return "", "", err } diff --git a/pkg/rbd/rbd_util.go b/pkg/rbd/rbd_util.go index 94d9569d5..757953264 100644 --- a/pkg/rbd/rbd_util.go +++ b/pkg/rbd/rbd_util.go @@ -372,7 +372,7 @@ func getMonsAndClusterID(options map[string]string) (monitors, clusterID string, if monitors, err = util.Mons(csiConfigFile, clusterID); err != nil { klog.Errorf("failed getting mons (%s)", err) - err = fmt.Errorf("failed to fetch monitor list using clusterID (%s)", clusterID) + err = errors.Wrapf(err, "failed to fetch monitor list using clusterID (%s)", clusterID) return }