From 0ea4491583ff29700fb7feb09b90a220876ca067 Mon Sep 17 00:00:00 2001 From: Prajwal Jarali Date: Wed, 4 Dec 2024 09:27:32 +0530 Subject: [PATCH] reverted flex wrapper of plain error to return plain error instance --- .../data_source_ibm_app_config_environment.go | 2 +- .../data_source_ibm_app_config_environments.go | 2 +- .../data_source_ibm_app_config_feature.go | 2 +- .../data_source_ibm_app_config_features.go | 2 +- .../data_source_ibm_app_config_segment.go | 2 +- .../resource_ibm_app_config_collection_test.go | 10 +++++----- .../resource_ibm_app_config_environment.go | 8 ++++---- .../resource_ibm_app_config_environment_test.go | 10 +++++----- .../resource_ibm_app_config_feature.go | 12 ++++++------ .../resource_ibm_app_config_feature_test.go | 10 +++++----- .../resource_ibm_app_config_property.go | 4 ++-- .../resource_ibm_app_config_property_test.go | 10 +++++----- .../resource_ibm_app_config_segment.go | 12 ++++++------ .../resource_ibm_app_config_segment_test.go | 10 +++++----- .../resource_ibm_app_config_snapshot.go | 8 ++++---- 15 files changed, 52 insertions(+), 52 deletions(-) diff --git a/ibm/service/appconfiguration/data_source_ibm_app_config_environment.go b/ibm/service/appconfiguration/data_source_ibm_app_config_environment.go index 390cdbc1fb..09c6d412a4 100644 --- a/ibm/service/appconfiguration/data_source_ibm_app_config_environment.go +++ b/ibm/service/appconfiguration/data_source_ibm_app_config_environment.go @@ -77,7 +77,7 @@ func dataSourceIbmAppConfigEnvironmentRead(d *schema.ResourceData, meta interfac appconfigClient, err := getAppConfigClient(meta, guid) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetEnvironmentOptions{} diff --git a/ibm/service/appconfiguration/data_source_ibm_app_config_environments.go b/ibm/service/appconfiguration/data_source_ibm_app_config_environments.go index e68a684a51..ebf07b869c 100644 --- a/ibm/service/appconfiguration/data_source_ibm_app_config_environments.go +++ b/ibm/service/appconfiguration/data_source_ibm_app_config_environments.go @@ -165,7 +165,7 @@ func dataSourceIbmAppConfigEnvironmentsRead(d *schema.ResourceData, meta interfa appconfigClient, err := getAppConfigClient(meta, guid) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.ListEnvironmentsOptions{} diff --git a/ibm/service/appconfiguration/data_source_ibm_app_config_feature.go b/ibm/service/appconfiguration/data_source_ibm_app_config_feature.go index 7b0a2c4cce..cdd6ce248f 100644 --- a/ibm/service/appconfiguration/data_source_ibm_app_config_feature.go +++ b/ibm/service/appconfiguration/data_source_ibm_app_config_feature.go @@ -172,7 +172,7 @@ func dataSourceIbmAppConfigFeatureRead(d *schema.ResourceData, meta interface{}) appconfigClient, err := getAppConfigClient(meta, guid) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetFeatureOptions{} diff --git a/ibm/service/appconfiguration/data_source_ibm_app_config_features.go b/ibm/service/appconfiguration/data_source_ibm_app_config_features.go index 34b5711223..8d3f5b40e0 100644 --- a/ibm/service/appconfiguration/data_source_ibm_app_config_features.go +++ b/ibm/service/appconfiguration/data_source_ibm_app_config_features.go @@ -282,7 +282,7 @@ func dataSourceIbmAppConfigFeaturesRead(d *schema.ResourceData, meta interface{} appconfigClient, err := getAppConfigClient(meta, guid) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.ListFeaturesOptions{} diff --git a/ibm/service/appconfiguration/data_source_ibm_app_config_segment.go b/ibm/service/appconfiguration/data_source_ibm_app_config_segment.go index cd83978e16..79eea135ba 100644 --- a/ibm/service/appconfiguration/data_source_ibm_app_config_segment.go +++ b/ibm/service/appconfiguration/data_source_ibm_app_config_segment.go @@ -133,7 +133,7 @@ func dataSourceIbmAppConfigSegmentRead(d *schema.ResourceData, meta interface{}) appconfigClient, err := getAppConfigClient(meta, guid) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetSegmentOptions{} diff --git a/ibm/service/appconfiguration/resource_ibm_app_config_collection_test.go b/ibm/service/appconfiguration/resource_ibm_app_config_collection_test.go index 77a46aecd0..629e3ed964 100644 --- a/ibm/service/appconfiguration/resource_ibm_app_config_collection_test.go +++ b/ibm/service/appconfiguration/resource_ibm_app_config_collection_test.go @@ -80,11 +80,11 @@ func testAccCheckIbmAppConfigCollectionExists(n string, obj appconfigurationv1.C } parts, err := flex.IdParts(rs.Primary.ID) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } appconfigClient, err := getAppConfigClient(acc.TestAccProvider.Meta(), parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetCollectionOptions{} @@ -93,7 +93,7 @@ func testAccCheckIbmAppConfigCollectionExists(n string, obj appconfigurationv1.C result, _, err := appconfigClient.GetCollection(options) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } obj = *result @@ -109,11 +109,11 @@ func testAccCheckIbmAppConfigCollectionDestroy(s *terraform.State) error { } parts, err := flex.IdParts(rs.Primary.ID) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } appconfigClient, err := getAppConfigClient(acc.TestAccProvider.Meta(), parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetCollectionOptions{} diff --git a/ibm/service/appconfiguration/resource_ibm_app_config_environment.go b/ibm/service/appconfiguration/resource_ibm_app_config_environment.go index 1a52c7a882..701c65da49 100644 --- a/ibm/service/appconfiguration/resource_ibm_app_config_environment.go +++ b/ibm/service/appconfiguration/resource_ibm_app_config_environment.go @@ -90,7 +90,7 @@ func resourceEnvironmentCreate(d *schema.ResourceData, meta interface{}) error { guid := d.Get("guid").(string) appconfigClient, err := getAppConfigClient(meta, guid) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.CreateEnvironmentOptions{} @@ -123,7 +123,7 @@ func resourceEnvironmentUpdate(d *schema.ResourceData, meta interface{}) error { } appconfigClient, err := getAppConfigClient(meta, parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.UpdateEnvironmentOptions{} @@ -156,7 +156,7 @@ func resourceEnvironmentRead(d *schema.ResourceData, meta interface{}) error { } appconfigClient, err := getAppConfigClient(meta, parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetEnvironmentOptions{} @@ -221,7 +221,7 @@ func resourceEnvironmentDelete(d *schema.ResourceData, meta interface{}) error { appconfigClient, err := getAppConfigClient(meta, parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.DeleteEnvironmentOptions{} diff --git a/ibm/service/appconfiguration/resource_ibm_app_config_environment_test.go b/ibm/service/appconfiguration/resource_ibm_app_config_environment_test.go index cdccd0b416..6ac7a43518 100644 --- a/ibm/service/appconfiguration/resource_ibm_app_config_environment_test.go +++ b/ibm/service/appconfiguration/resource_ibm_app_config_environment_test.go @@ -103,12 +103,12 @@ func testAccCheckIbmAppConfigEnvironmentExists(n string, obj appconfigurationv1. parts, err := flex.IdParts(rs.Primary.ID) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } appconfigClient, err := getAppConfigClient(acc.TestAccProvider.Meta(), parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetEnvironmentOptions{} @@ -116,7 +116,7 @@ func testAccCheckIbmAppConfigEnvironmentExists(n string, obj appconfigurationv1. result, _, err := appconfigClient.GetEnvironment(options) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } obj = *result @@ -132,12 +132,12 @@ func testAccCheckIbmAppConfigEnvironmentDestroy(s *terraform.State) error { parts, err := flex.IdParts(rs.Primary.ID) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } appconfigClient, err := getAppConfigClient(acc.TestAccProvider.Meta(), parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetEnvironmentOptions{} options.SetEnvironmentID(parts[1]) diff --git a/ibm/service/appconfiguration/resource_ibm_app_config_feature.go b/ibm/service/appconfiguration/resource_ibm_app_config_feature.go index 22a667209d..c1aadacdaa 100644 --- a/ibm/service/appconfiguration/resource_ibm_app_config_feature.go +++ b/ibm/service/appconfiguration/resource_ibm_app_config_feature.go @@ -166,7 +166,7 @@ func resourceIbmIbmAppConfigFeatureCreate(d *schema.ResourceData, meta interface guid := d.Get("guid").(string) appconfigClient, err := getAppConfigClient(meta, guid) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.CreateFeatureOptions{} options.SetType(d.Get("type").(string)) @@ -194,7 +194,7 @@ func resourceIbmIbmAppConfigFeatureCreate(d *schema.ResourceData, meta interface value := e.(map[string]interface{}) segmentRulesItem, err := resourceIbmAppConfigFeatureMapToSegmentRule(d, value) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } segmentRules = append(segmentRules, segmentRulesItem) } @@ -226,7 +226,7 @@ func resourceIbmIbmAppConfigFeatureUpdate(d *schema.ResourceData, meta interface } appconfigClient, err := getAppConfigClient(meta, parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.UpdateFeatureOptions{} @@ -253,7 +253,7 @@ func resourceIbmIbmAppConfigFeatureUpdate(d *schema.ResourceData, meta interface value := e.(map[string]interface{}) segmentRulesItem, err := resourceIbmAppConfigFeatureMapToSegmentRule(d, value) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } segmentRules = append(segmentRules, segmentRulesItem) } @@ -285,7 +285,7 @@ func resourceIbmIbmAppConfigFeatureRead(d *schema.ResourceData, meta interface{} } appconfigClient, err := getAppConfigClient(meta, parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetFeatureOptions{} @@ -417,7 +417,7 @@ func resourceIbmIbmAppConfigFeatureDelete(d *schema.ResourceData, meta interface } appconfigClient, err := getAppConfigClient(meta, parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.DeleteFeatureOptions{} diff --git a/ibm/service/appconfiguration/resource_ibm_app_config_feature_test.go b/ibm/service/appconfiguration/resource_ibm_app_config_feature_test.go index cc180faa62..bb27ae0cbf 100644 --- a/ibm/service/appconfiguration/resource_ibm_app_config_feature_test.go +++ b/ibm/service/appconfiguration/resource_ibm_app_config_feature_test.go @@ -92,11 +92,11 @@ func testAccCheckIbmAppConfigFeatureExists(n string, obj appconfigurationv1.Feat } parts, err := flex.IdParts(rs.Primary.ID) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } appconfigClient, err := getAppConfigClient(acc.TestAccProvider.Meta(), parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetFeatureOptions{} @@ -106,7 +106,7 @@ func testAccCheckIbmAppConfigFeatureExists(n string, obj appconfigurationv1.Feat result, _, err := appconfigClient.GetFeature(options) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } obj = *result @@ -122,11 +122,11 @@ func testAccCheckIbmAppConfigFeatureDestroy(s *terraform.State) error { } parts, err := flex.IdParts(rs.Primary.ID) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } appconfigClient, err := getAppConfigClient(acc.TestAccProvider.Meta(), parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetFeatureOptions{} diff --git a/ibm/service/appconfiguration/resource_ibm_app_config_property.go b/ibm/service/appconfiguration/resource_ibm_app_config_property.go index 3cac255ee0..4d71d6e555 100644 --- a/ibm/service/appconfiguration/resource_ibm_app_config_property.go +++ b/ibm/service/appconfiguration/resource_ibm_app_config_property.go @@ -184,7 +184,7 @@ func resourceIbmIbmAppConfigPropertyCreate(d *schema.ResourceData, meta interfac value := e.(map[string]interface{}) segmentRulesItem, err := resourceIbmAppConfigPropertyMapToSegmentRule(d, value) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } segmentRules = append(segmentRules, segmentRulesItem) } @@ -350,7 +350,7 @@ func resourceIbmIbmAppConfigPropertyUpdate(d *schema.ResourceData, meta interfac value := e.(map[string]interface{}) segmentRulesItem, err := resourceIbmAppConfigPropertyMapToSegmentRule(d, value) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } segmentRules = append(segmentRules, segmentRulesItem) } diff --git a/ibm/service/appconfiguration/resource_ibm_app_config_property_test.go b/ibm/service/appconfiguration/resource_ibm_app_config_property_test.go index 6f7b717583..117b693acf 100644 --- a/ibm/service/appconfiguration/resource_ibm_app_config_property_test.go +++ b/ibm/service/appconfiguration/resource_ibm_app_config_property_test.go @@ -90,12 +90,12 @@ func testAccCheckIbmAppConfigPropertyExists(n string, obj appconfigurationv1.Pro parts, err := flex.IdParts(rs.Primary.ID) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } appconfigClient, err := getAppConfigClient(acc.TestAccProvider.Meta(), parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetPropertyOptions{} @@ -104,7 +104,7 @@ func testAccCheckIbmAppConfigPropertyExists(n string, obj appconfigurationv1.Pro property, _, err := appconfigClient.GetProperty(options) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } obj = *property @@ -119,12 +119,12 @@ func testAccCheckIbmAppConfigPropertyDestroy(s *terraform.State) error { } parts, err := flex.IdParts(rs.Primary.ID) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } appconfigClient, err := getAppConfigClient(acc.TestAccProvider.Meta(), parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetPropertyOptions{} diff --git a/ibm/service/appconfiguration/resource_ibm_app_config_segment.go b/ibm/service/appconfiguration/resource_ibm_app_config_segment.go index f0bd11eedb..de36eb75a1 100644 --- a/ibm/service/appconfiguration/resource_ibm_app_config_segment.go +++ b/ibm/service/appconfiguration/resource_ibm_app_config_segment.go @@ -92,7 +92,7 @@ func resourceIbmIbmAppConfigSegmentCreate(d *schema.ResourceData, meta interface guid := d.Get("guid").(string) appconfigClient, err := getAppConfigClient(meta, guid) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.CreateSegmentOptions{} options.SetName(d.Get("name").(string)) @@ -111,7 +111,7 @@ func resourceIbmIbmAppConfigSegmentCreate(d *schema.ResourceData, meta interface value := e.(map[string]interface{}) segmentRulesItem, err := resourceIbmAppConfigMapToSegmentRule(value) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } segmentRules = append(segmentRules, segmentRulesItem) } @@ -151,7 +151,7 @@ func resourceIbmIbmAppConfigSegmentRead(d *schema.ResourceData, meta interface{} appconfigClient, err := getAppConfigClient(meta, parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetSegmentOptions{} @@ -234,7 +234,7 @@ func resourceIbmIbmAppConfigSegmentUpdate(d *schema.ResourceData, meta interface } appconfigClient, err := getAppConfigClient(meta, parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.UpdateSegmentOptions{} @@ -257,7 +257,7 @@ func resourceIbmIbmAppConfigSegmentUpdate(d *schema.ResourceData, meta interface value := e.(map[string]interface{}) segmentRulesItem, err := resourceIbmAppConfigMapToSegmentRule(value) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } segmentRules = append(segmentRules, segmentRulesItem) } @@ -280,7 +280,7 @@ func resourceIbmIbmAppConfigSegmentDelete(d *schema.ResourceData, meta interface } appconfigClient, err := getAppConfigClient(meta, parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.DeleteSegmentOptions{} diff --git a/ibm/service/appconfiguration/resource_ibm_app_config_segment_test.go b/ibm/service/appconfiguration/resource_ibm_app_config_segment_test.go index 5eab0c3fb2..41fa2e51e1 100644 --- a/ibm/service/appconfiguration/resource_ibm_app_config_segment_test.go +++ b/ibm/service/appconfiguration/resource_ibm_app_config_segment_test.go @@ -79,11 +79,11 @@ func testAccCheckIbmAppConfigSegmentExists(n string, obj appconfigurationv1.Segm } parts, err := flex.IdParts(rs.Primary.ID) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } appconfigClient, err := getAppConfigClient(acc.TestAccProvider.Meta(), parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetSegmentOptions{} @@ -92,7 +92,7 @@ func testAccCheckIbmAppConfigSegmentExists(n string, obj appconfigurationv1.Segm result, _, err := appconfigClient.GetSegment(options) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } obj = *result @@ -108,11 +108,11 @@ func testAccCheckIbmAppConfigSegmentDestroy(s *terraform.State) error { } parts, err := flex.IdParts(rs.Primary.ID) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } appconfigClient, err := getAppConfigClient(acc.TestAccProvider.Meta(), parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.GetSegmentOptions{} diff --git a/ibm/service/appconfiguration/resource_ibm_app_config_snapshot.go b/ibm/service/appconfiguration/resource_ibm_app_config_snapshot.go index c196f08d69..1219609b09 100644 --- a/ibm/service/appconfiguration/resource_ibm_app_config_snapshot.go +++ b/ibm/service/appconfiguration/resource_ibm_app_config_snapshot.go @@ -136,7 +136,7 @@ func resourceIbmIbmAppConfigSnapshotCreate(d *schema.ResourceData, meta interfac guid := d.Get("guid").(string) appconfigClient, err := getAppConfigClient(meta, guid) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.CreateGitconfigOptions{} @@ -166,7 +166,7 @@ func resourceIbmIbmAppConfigSnapshotUpdate(d *schema.ResourceData, meta interfac } appconfigClient, err := getAppConfigClient(meta, parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } if ok := d.HasChanges("action"); ok { @@ -219,7 +219,7 @@ func resourceIbmIbmAppConfigSnapshotRead(d *schema.ResourceData, meta interface{ } appconfigClient, err := getAppConfigClient(meta, parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } if len(parts) != 2 { return flex.FmtErrorf("Kindly check the id") @@ -285,7 +285,7 @@ func resourceIbmIbmAppConfigSnapshotDelete(d *schema.ResourceData, meta interfac } appconfigClient, err := getAppConfigClient(meta, parts[0]) if err != nil { - return flex.FmtErrorf(fmt.Sprintf("%s", err)) + return err } options := &appconfigurationv1.DeleteGitconfigOptions{}