From 268fc9ab8e630ea15cfacc40d0aa3b6caf03acb3 Mon Sep 17 00:00:00 2001 From: Yannick Struyf Date: Mon, 28 Aug 2023 14:00:38 +0200 Subject: [PATCH] add error return when category value cannot be created (#308) --- controllers/helpers.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/controllers/helpers.go b/controllers/helpers.go index cf0ca01e86..ede1634f3a 100644 --- a/controllers/helpers.go +++ b/controllers/helpers.go @@ -587,7 +587,9 @@ func getOrCreateCategory(ctx context.Context, client *nutanixClientV3.Client, ca Value: utils.StringPtr(categoryIdentifier.Value), }) if err != nil { - log.Error(err, fmt.Sprintf("failed to create category value %s in category key %s", categoryIdentifier.Value, categoryIdentifier.Key)) + errorMsg := fmt.Errorf("failed to create category value %s in category key %s: %v", categoryIdentifier.Value, categoryIdentifier.Key, err) + log.Error(errorMsg, "failed to create category value") + return nil, errorMsg } } return categoryValue, nil