@@ -93,6 +93,11 @@ private static String removeScheme(String url) {
9393
9494 private static DatastoreException translate (
9595 com .google .datastore .v1 .client .DatastoreException exception ) {
96+ return translate (exception , true );
97+ }
98+
99+ private static DatastoreException translate (
100+ com .google .datastore .v1 .client .DatastoreException exception , boolean idempotent ) {
96101 String reason = "" ;
97102 if (exception .getCode () != null ) {
98103 reason = exception .getCode ().name ();
@@ -103,15 +108,14 @@ private static DatastoreException translate(
103108 }
104109 }
105110 return new DatastoreException (
106- exception .getCode ().getNumber (), exception .getMessage (), reason , exception );
111+ exception .getCode ().getNumber (), exception .getMessage (), reason , idempotent , exception );
107112 }
108113
109114 @ Override
110115 public AllocateIdsResponse allocateIds (AllocateIdsRequest request ) {
111116 try {
112117 return client .allocateIds (request );
113118 } catch (com .google .datastore .v1 .client .DatastoreException ex ) {
114-
115119 throw translate (ex );
116120 }
117121 }
@@ -130,7 +134,7 @@ public CommitResponse commit(CommitRequest request) {
130134 try {
131135 return client .commit (request );
132136 } catch (com .google .datastore .v1 .client .DatastoreException ex ) {
133- throw translate (ex );
137+ throw translate (ex , request . getMode () == CommitRequest . Mode . NON_TRANSACTIONAL );
134138 }
135139 }
136140
0 commit comments