Skip to content

Commit

Permalink
Wrap 404 error so it can be detected later, instead of overwriting. (#…
Browse files Browse the repository at this point in the history
…950)

Merged PR #950.
  • Loading branch information
nat-henderson authored and modular-magician committed Nov 27, 2018
1 parent b33fc05 commit f6a2ac4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package google

import (
"fmt"

"github.com/hashicorp/errwrap"
"github.com/hashicorp/terraform/helper/schema"
"google.golang.org/api/logging/v2"
Expand Down Expand Up @@ -58,7 +59,7 @@ func (u *BillingAccountLoggingExclusionUpdater) ReadLoggingExclusion(id string)
exclusion, err := u.Config.clientLogging.BillingAccounts.Exclusions.Get(id).Do()

if err != nil {
return nil, fmt.Errorf("Error retrieving logging exclusion for %s: %s", u.DescribeResource(), err)
return nil, errwrap.Wrapf(fmt.Sprintf("Error retrieving logging exclusion for %s: {{err}}", u.DescribeResource()), err)
}

return exclusion, nil
Expand Down
3 changes: 2 additions & 1 deletion third_party/terraform/utils/logging_exclusion_folder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package google

import (
"fmt"

"github.com/hashicorp/errwrap"
"github.com/hashicorp/terraform/helper/schema"
"google.golang.org/api/logging/v2"
Expand Down Expand Up @@ -59,7 +60,7 @@ func (u *FolderLoggingExclusionUpdater) ReadLoggingExclusion(id string) (*loggin
exclusion, err := u.Config.clientLogging.Folders.Exclusions.Get(id).Do()

if err != nil {
return nil, fmt.Errorf("Error retrieving logging exclusion for %s: %s", u.DescribeResource(), err)
return nil, errwrap.Wrapf(fmt.Sprintf("Error retrieving logging exclusion for %s: {{err}}", u.DescribeResource()), err)
}

return exclusion, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package google

import (
"fmt"

"github.com/hashicorp/errwrap"
"github.com/hashicorp/terraform/helper/schema"
"google.golang.org/api/logging/v2"
Expand Down Expand Up @@ -58,7 +59,7 @@ func (u *OrganizationLoggingExclusionUpdater) ReadLoggingExclusion(id string) (*
exclusion, err := u.Config.clientLogging.Organizations.Exclusions.Get(id).Do()

if err != nil {
return nil, fmt.Errorf("Error retrieving logging exclusion for %s: %s", u.DescribeResource(), err)
return nil, errwrap.Wrapf(fmt.Sprintf("Error retrieving logging exclusion for %s: {{err}}", u.DescribeResource()), err)
}

return exclusion, nil
Expand Down
3 changes: 2 additions & 1 deletion third_party/terraform/utils/logging_exclusion_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package google

import (
"fmt"

"github.com/hashicorp/errwrap"
"github.com/hashicorp/terraform/helper/schema"
"google.golang.org/api/logging/v2"
Expand Down Expand Up @@ -65,7 +66,7 @@ func (u *ProjectLoggingExclusionUpdater) ReadLoggingExclusion(id string) (*loggi
exclusion, err := u.Config.clientLogging.Projects.Exclusions.Get(id).Do()

if err != nil {
return nil, fmt.Errorf("Error retrieving logging exclusion for %s: %s", u.DescribeResource(), err)
return nil, errwrap.Wrapf(fmt.Sprintf("Error retrieving logging exclusion for %s: {{err}}", u.DescribeResource()), err)
}

return exclusion, nil
Expand Down

0 comments on commit f6a2ac4

Please sign in to comment.