Skip to content

Commit

Permalink
nest err check inside to prevent failures
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz committed Feb 11, 2022
1 parent 2dca8bf commit 711522e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ func resourceCloudflareCustomHostnameFallbackOriginCreate(d *schema.ResourceData
return resource.Retry(d.Timeout(schema.TimeoutDefault), func() *resource.RetryError {
_, err := client.UpdateCustomHostnameFallbackOrigin(context.Background(), zoneID, fallbackOrigin)
if err != nil {
if errors.As(err, &cloudflare.APIRequestError{}) && err.(*cloudflare.APIRequestError).InternalErrorCodeIs(1414) {
return resource.RetryableError(fmt.Errorf("expected custom hostname resource to be ready for modification but is still pending"))
if errors.As(err, &cloudflare.APIRequestError{}) {
if err.(*cloudflare.APIRequestError).InternalErrorCodeIs(1414) {
return resource.RetryableError(fmt.Errorf("expected custom hostname resource to be ready for modification but is still pending"))
}
} else {
return resource.NonRetryableError(errors.Wrap(err, "failed to create custom hostname fallback origin"))
}
Expand Down

0 comments on commit 711522e

Please sign in to comment.