1
1
package improvmx
2
2
3
3
import (
4
+ "fmt"
4
5
"log"
5
6
"time"
6
7
@@ -47,6 +48,11 @@ func resourceDomainCreate(d *schema.ResourceData, meta interface{}) error {
47
48
time .Sleep (10 * time .Second )
48
49
}
49
50
51
+ if resp .Code == 404 {
52
+ log .Printf ("[DEBUG] Couldn't find the resource in ImprovMX. Aborting" )
53
+ return fmt .Errorf ("HTTP response code %d, error text: %s" , resp .Code , resp .Errors .Domain )
54
+ }
55
+
50
56
if resp .Success {
51
57
return resourceDomainRead (d , meta )
52
58
}
@@ -68,6 +74,11 @@ func resourceDomainRead(d *schema.ResourceData, meta interface{}) error {
68
74
time .Sleep (10 * time .Second )
69
75
}
70
76
77
+ if resp .Code == 404 {
78
+ log .Printf ("[DEBUG] Couldn't find the resource in ImprovMX. Aborting" )
79
+ return fmt .Errorf ("HTTP response code %d, error text: %s" , resp .Code , resp .Errors .Domain )
80
+ }
81
+
71
82
if resp .Success {
72
83
d .SetId (resp .Domain .Domain )
73
84
d .Set ("domain" , resp .Domain .Domain )
@@ -92,6 +103,11 @@ func resourceDomainUpdate(d *schema.ResourceData, meta interface{}) error {
92
103
time .Sleep (10 * time .Second )
93
104
}
94
105
106
+ if resp .Code == 404 {
107
+ log .Printf ("[DEBUG] Couldn't find the resource in ImprovMX. Aborting" )
108
+ return fmt .Errorf ("HTTP response code %d, error text: %s" , resp .Code , resp .Errors .Domain )
109
+ }
110
+
95
111
if resp .Success {
96
112
return resourceDomainRead (d , meta )
97
113
}
0 commit comments