From 1caa4db86af28f193f40a1facac714d863246063 Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Fri, 7 Feb 2020 16:41:15 +0000 Subject: [PATCH] change error wrap formatting (#3089) Signed-off-by: Modular Magician --- .changelog/3089.txt | 3 +++ google/resource_google_project.go | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 .changelog/3089.txt diff --git a/.changelog/3089.txt b/.changelog/3089.txt new file mode 100644 index 00000000000..8ec013c0699 --- /dev/null +++ b/.changelog/3089.txt @@ -0,0 +1,3 @@ +```release-note:none + +``` diff --git a/google/resource_google_project.go b/google/resource_google_project.go index c14b70c10d4..797d7fa4604 100644 --- a/google/resource_google_project.go +++ b/google/resource_google_project.go @@ -159,14 +159,14 @@ func resourceGoogleProjectCreate(d *schema.ResourceData, meta interface{}) error if !d.Get("auto_create_network").(bool) { // The compute API has to be enabled before we can delete a network. if err = enableServiceUsageProjectServices([]string{"compute.googleapis.com"}, project.ProjectId, config, d.Timeout(schema.TimeoutCreate)); err != nil { - return errwrap.Wrapf("Error enabling the Compute Engine API required to delete the default network: ", err) + return errwrap.Wrapf("Error enabling the Compute Engine API required to delete the default network: {{err}} ", err) } if err = forceDeleteComputeNetwork(d, config, project.ProjectId, "default"); err != nil { if isGoogleApiErrorWithCode(err, 404) { log.Printf("[DEBUG] Default network not found for project %q, no need to delete it", project.ProjectId) } else { - return errwrap.Wrapf(fmt.Sprintf("Error deleting default network in project %s: ", project.ProjectId), err) + return errwrap.Wrapf(fmt.Sprintf("Error deleting default network in project %s: {{err}}", project.ProjectId), err) } } } @@ -397,7 +397,7 @@ func forceDeleteComputeNetwork(d *schema.ResourceData, config *Config, projectId filter := fmt.Sprintf("network eq %s", networkLink) resp, err := config.clientCompute.Firewalls.List(projectId).Filter(filter).Do() if err != nil { - return errwrap.Wrapf("Error listing firewall rules in proj:", err) + return errwrap.Wrapf("Error listing firewall rules in proj: {{err}}", err) } log.Printf("[DEBUG] Found %d firewall rules in %q network", len(resp.Items), networkName) @@ -405,7 +405,7 @@ func forceDeleteComputeNetwork(d *schema.ResourceData, config *Config, projectId for _, firewall := range resp.Items { op, err := config.clientCompute.Firewalls.Delete(projectId, firewall.Name).Do() if err != nil { - return errwrap.Wrapf("Error deleting firewall: ", err) + return errwrap.Wrapf("Error deleting firewall: {{err}}", err) } err = computeOperationWait(config, op, projectId, "Deleting Firewall") if err != nil { @@ -456,7 +456,7 @@ func deleteComputeNetwork(project, network string, config *Config) error { op, err := config.clientCompute.Networks.Delete( project, network).Do() if err != nil { - return errwrap.Wrapf("Error deleting network: ", err) + return errwrap.Wrapf("Error deleting network: {{err}}", err) } err = computeOperationWaitTime(config, op, project, "Deleting Network", 10)