aboutsummaryrefslogtreecommitdiffstats
path: root/src/dcm/pkg/module/logicalcloud.go
diff options
context:
space:
mode:
authorIgor D.C <igor.duarte.cardoso@intel.com>2020-09-25 00:04:58 +0000
committerIgor D.C <igor.duarte.cardoso@intel.com>2020-09-25 05:28:52 +0000
commitc585d2b091875dbc9575a960f4f42c1f14ec3366 (patch)
treeaba0039b6477dfbc2790cd5efc365a6d9ccb4390 /src/dcm/pkg/module/logicalcloud.go
parentab8142dfc0f54bfc140e240fe558ac5be8d60ea5 (diff)
Enhance error handling and HTTP codes in DCM
This improves error handling between DCM and the database resources and adds/corrects a lot more HTTP return codes in the API, respectively. Issue-ID: MULTICLOUD-1143 Change-Id: I3abc8025660e042f4c946f8bbfd280e1eb4c9583 Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
Diffstat (limited to 'src/dcm/pkg/module/logicalcloud.go')
-rw-r--r--src/dcm/pkg/module/logicalcloud.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dcm/pkg/module/logicalcloud.go b/src/dcm/pkg/module/logicalcloud.go
index 51ee387d..7d3c806b 100644
--- a/src/dcm/pkg/module/logicalcloud.go
+++ b/src/dcm/pkg/module/logicalcloud.go
@@ -145,7 +145,7 @@ func (v *LogicalCloudClient) Get(project, logicalCloudName string) (LogicalCloud
}
value, err := v.util.DBFind(v.storeName, key, v.tagMeta)
if err != nil {
- return LogicalCloud{}, pkgerrors.Wrap(err, "Get Logical Cloud")
+ return LogicalCloud{}, pkgerrors.Wrap(err, "Error getting Logical Cloud")
}
//value is a byte array
@@ -153,12 +153,12 @@ func (v *LogicalCloudClient) Get(project, logicalCloudName string) (LogicalCloud
lc := LogicalCloud{}
err = v.util.DBUnmarshal(value[0], &lc)
if err != nil {
- return LogicalCloud{}, pkgerrors.Wrap(err, "Unmarshaling value")
+ return LogicalCloud{}, pkgerrors.Wrap(err, "Error unmarshaling value")
}
return lc, nil
}
- return LogicalCloud{}, pkgerrors.New("Error getting Logical Cloud")
+ return LogicalCloud{}, pkgerrors.New("Logical Cloud does not exist")
}
// GetAll returns Logical Clouds in the project
@@ -213,12 +213,12 @@ func (v *LogicalCloudClient) Update(project, logicalCloudName string, c LogicalC
}
// Check for mismatch, logicalCloudName and payload logical cloud name
if c.MetaData.LogicalCloudName != logicalCloudName {
- return LogicalCloud{}, pkgerrors.New("Update Error - Logical Cloud name mismatch")
+ return LogicalCloud{}, pkgerrors.New("Logical Cloud name mismatch")
}
//Check if this Logical Cloud exists
_, err := v.Get(project, logicalCloudName)
if err != nil {
- return LogicalCloud{}, pkgerrors.New("Update Error - Logical Cloud doesn't exist")
+ return LogicalCloud{}, pkgerrors.New("Logical Cloud does not exist")
}
err = v.util.DBInsert(v.storeName, key, nil, v.tagMeta, c)
if err != nil {