@@ -36,8 +36,8 @@ public class DefaultDnsRpc implements DnsRpc {
36
36
private final Dns dns ;
37
37
private final DnsOptions options ;
38
38
39
- private static DnsException translate (IOException exception ) {
40
- return new DnsException (exception );
39
+ private static DnsException translate (IOException exception , boolean idempotent ) {
40
+ return new DnsException (exception , idempotent );
41
41
}
42
42
43
43
/**
@@ -61,7 +61,7 @@ public ManagedZone create(ManagedZone zone, Map<Option, ?> options) throws DnsEx
61
61
.setFields (FIELDS .getString (options ))
62
62
.execute ();
63
63
} catch (IOException ex ) {
64
- throw translate (ex );
64
+ throw translate (ex , false );
65
65
}
66
66
}
67
67
@@ -73,7 +73,7 @@ public ManagedZone getZone(String zoneName, Map<Option, ?> options) throws DnsEx
73
73
.setFields (FIELDS .getString (options ))
74
74
.execute ();
75
75
} catch (IOException ex ) {
76
- DnsException serviceException = translate (ex );
76
+ DnsException serviceException = translate (ex , true );
77
77
if (serviceException .code () == HTTP_NOT_FOUND ) {
78
78
return null ;
79
79
}
@@ -93,7 +93,7 @@ public ListResult<ManagedZone> listZones(Map<Option, ?> options) throws DnsExcep
93
93
.execute ();
94
94
return of (zoneList .getNextPageToken (), zoneList .getManagedZones ());
95
95
} catch (IOException ex ) {
96
- throw translate (ex );
96
+ throw translate (ex , true );
97
97
}
98
98
}
99
99
@@ -103,7 +103,7 @@ public boolean deleteZone(String zoneName) throws DnsException {
103
103
dns .managedZones ().delete (this .options .projectId (), zoneName ).execute ();
104
104
return true ;
105
105
} catch (IOException ex ) {
106
- DnsException serviceException = translate (ex );
106
+ DnsException serviceException = translate (ex , false );
107
107
if (serviceException .code () == HTTP_NOT_FOUND ) {
108
108
return false ;
109
109
}
@@ -126,7 +126,7 @@ public ListResult<ResourceRecordSet> listRecordSets(String zoneName, Map<Option,
126
126
.execute ();
127
127
return of (response .getNextPageToken (), response .getRrsets ());
128
128
} catch (IOException ex ) {
129
- throw translate (ex );
129
+ throw translate (ex , true );
130
130
}
131
131
}
132
132
@@ -136,7 +136,7 @@ public Project getProject(Map<Option, ?> options) throws DnsException {
136
136
return dns .projects ().get (this .options .projectId ())
137
137
.setFields (FIELDS .getString (options )).execute ();
138
138
} catch (IOException ex ) {
139
- throw translate (ex );
139
+ throw translate (ex , true );
140
140
}
141
141
}
142
142
@@ -148,7 +148,7 @@ public Change applyChangeRequest(String zoneName, Change changeRequest, Map<Opti
148
148
.setFields (FIELDS .getString (options ))
149
149
.execute ();
150
150
} catch (IOException ex ) {
151
- throw translate (ex );
151
+ throw translate (ex , false );
152
152
}
153
153
}
154
154
@@ -160,7 +160,7 @@ public Change getChangeRequest(String zoneName, String changeRequestId, Map<Opti
160
160
.setFields (FIELDS .getString (options ))
161
161
.execute ();
162
162
} catch (IOException ex ) {
163
- DnsException serviceException = translate (ex );
163
+ DnsException serviceException = translate (ex , true );
164
164
if (serviceException .code () == HTTP_NOT_FOUND ) {
165
165
if ("entity.parameters.changeId" .equals (serviceException .location ())
166
166
|| (serviceException .getMessage () != null
@@ -190,7 +190,7 @@ public ListResult<Change> listChangeRequests(String zoneName, Map<Option, ?> opt
190
190
ChangesListResponse response = request .execute ();
191
191
return of (response .getNextPageToken (), response .getChanges ());
192
192
} catch (IOException ex ) {
193
- throw translate (ex );
193
+ throw translate (ex , true );
194
194
}
195
195
}
196
196
}
0 commit comments