@@ -623,10 +623,12 @@ public synchronized Status startBatchTxn(
623
623
} catch (SpannerException e ) {
624
624
return sender .finishWithError (toStatus (e ));
625
625
} catch (Exception e ) {
626
+ LOGGER .log (Level .WARNING , "Unexpected error: " + e .getMessage ());
626
627
return sender .finishWithError (
627
628
toStatus (
628
629
SpannerExceptionFactory .newSpannerException (
629
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e .getMessage ())));
630
+ ErrorCode .INVALID_ARGUMENT ,
631
+ CloudClientExecutor .unexpectedExceptionResponse (e ))));
630
632
}
631
633
}
632
634
@@ -730,7 +732,8 @@ public synchronized Status finish(Mode finishMode, OutcomeSender sender) {
730
732
return sender .finishWithError (
731
733
toStatus (
732
734
SpannerExceptionFactory .newSpannerException (
733
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e .getMessage ())));
735
+ ErrorCode .INVALID_ARGUMENT ,
736
+ CloudClientExecutor .unexpectedExceptionResponse (e ))));
734
737
}
735
738
return sender .sendOutcome (outcomeBuilder .build ());
736
739
} else if (batchTxn != null ) {
@@ -1075,7 +1078,7 @@ private Status executeAction(
1075
1078
return outcomeSender .finishWithError (
1076
1079
toStatus (
1077
1080
SpannerExceptionFactory .newSpannerException (
1078
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1081
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1079
1082
} finally {
1080
1083
scope .close ();
1081
1084
span .end ();
@@ -1171,7 +1174,7 @@ private Status executeAdminAction(
1171
1174
return outcomeSender .finishWithError (
1172
1175
toStatus (
1173
1176
SpannerExceptionFactory .newSpannerException (
1174
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1177
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1175
1178
}
1176
1179
}
1177
1180
@@ -1260,7 +1263,7 @@ private Status executeUpdateCloudInstance(
1260
1263
return sender .finishWithError (
1261
1264
toStatus (
1262
1265
SpannerExceptionFactory .newSpannerException (
1263
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1266
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1264
1267
}
1265
1268
return sender .finishWithOK ();
1266
1269
}
@@ -1282,7 +1285,7 @@ private Status executeDeleteCloudInstance(
1282
1285
return sender .finishWithError (
1283
1286
toStatus (
1284
1287
SpannerExceptionFactory .newSpannerException (
1285
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1288
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1286
1289
}
1287
1290
return sender .finishWithOK ();
1288
1291
}
@@ -1330,7 +1333,7 @@ private Status executeListCloudInstances(
1330
1333
return sender .finishWithError (
1331
1334
toStatus (
1332
1335
SpannerExceptionFactory .newSpannerException (
1333
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1336
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1334
1337
}
1335
1338
}
1336
1339
@@ -1374,7 +1377,7 @@ private Status executeListCloudInstanceConfigs(
1374
1377
return sender .finishWithError (
1375
1378
toStatus (
1376
1379
SpannerExceptionFactory .newSpannerException (
1377
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1380
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1378
1381
}
1379
1382
}
1380
1383
@@ -1405,7 +1408,7 @@ private Status executeGetCloudInstanceConfig(
1405
1408
return sender .finishWithError (
1406
1409
toStatus (
1407
1410
SpannerExceptionFactory .newSpannerException (
1408
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1411
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1409
1412
}
1410
1413
}
1411
1414
@@ -1436,7 +1439,7 @@ private Status executeGetCloudInstance(
1436
1439
return sender .finishWithError (
1437
1440
toStatus (
1438
1441
SpannerExceptionFactory .newSpannerException (
1439
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1442
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1440
1443
}
1441
1444
}
1442
1445
@@ -1466,7 +1469,7 @@ private Status executeCreateUserInstanceConfig(
1466
1469
return sender .finishWithError (
1467
1470
toStatus (
1468
1471
SpannerExceptionFactory .newSpannerException (
1469
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1472
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1470
1473
}
1471
1474
return sender .finishWithOK ();
1472
1475
}
@@ -1486,7 +1489,7 @@ private Status executeDeleteUserInstanceConfig(
1486
1489
return sender .finishWithError (
1487
1490
toStatus (
1488
1491
SpannerExceptionFactory .newSpannerException (
1489
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1492
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1490
1493
}
1491
1494
return sender .finishWithOK ();
1492
1495
}
@@ -1515,7 +1518,7 @@ private Status executeCreateCloudCustomEncryptedDatabase(
1515
1518
return sender .finishWithError (
1516
1519
toStatus (
1517
1520
SpannerExceptionFactory .newSpannerException (
1518
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1521
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1519
1522
}
1520
1523
return sender .finishWithOK ();
1521
1524
}
@@ -1550,7 +1553,7 @@ private Status executeCreateCloudDatabase(
1550
1553
return sender .finishWithError (
1551
1554
toStatus (
1552
1555
SpannerExceptionFactory .newSpannerException (
1553
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1556
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1554
1557
}
1555
1558
return sender .finishWithOK ();
1556
1559
}
@@ -1584,7 +1587,7 @@ private Status executeUpdateCloudDatabaseDdl(
1584
1587
return sender .finishWithError (
1585
1588
toStatus (
1586
1589
SpannerExceptionFactory .newSpannerException (
1587
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1590
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1588
1591
}
1589
1592
return sender .finishWithOK ();
1590
1593
}
@@ -1605,7 +1608,7 @@ private Status executeDropCloudDatabase(
1605
1608
return sender .finishWithError (
1606
1609
toStatus (
1607
1610
SpannerExceptionFactory .newSpannerException (
1608
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1611
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1609
1612
}
1610
1613
return sender .finishWithOK ();
1611
1614
}
@@ -1642,7 +1645,7 @@ private Status executeCreateCloudBackup(
1642
1645
return sender .finishWithError (
1643
1646
toStatus (
1644
1647
SpannerExceptionFactory .newSpannerException (
1645
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1648
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1646
1649
}
1647
1650
}
1648
1651
@@ -1678,7 +1681,7 @@ private Status executeCopyCloudBackup(
1678
1681
return sender .finishWithError (
1679
1682
toStatus (
1680
1683
SpannerExceptionFactory .newSpannerException (
1681
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1684
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1682
1685
}
1683
1686
}
1684
1687
@@ -1709,7 +1712,7 @@ private Status executeGetCloudBackup(
1709
1712
return sender .finishWithError (
1710
1713
toStatus (
1711
1714
SpannerExceptionFactory .newSpannerException (
1712
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1715
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1713
1716
}
1714
1717
}
1715
1718
@@ -1743,7 +1746,7 @@ private Status executeUpdateCloudBackup(
1743
1746
return sender .finishWithError (
1744
1747
toStatus (
1745
1748
SpannerExceptionFactory .newSpannerException (
1746
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1749
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1747
1750
}
1748
1751
}
1749
1752
@@ -1763,7 +1766,7 @@ private Status executeDeleteCloudBackup(
1763
1766
return sender .finishWithError (
1764
1767
toStatus (
1765
1768
SpannerExceptionFactory .newSpannerException (
1766
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1769
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1767
1770
}
1768
1771
}
1769
1772
@@ -1803,7 +1806,7 @@ private Status executeListCloudBackups(
1803
1806
return sender .finishWithError (
1804
1807
toStatus (
1805
1808
SpannerExceptionFactory .newSpannerException (
1806
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1809
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1807
1810
}
1808
1811
}
1809
1812
@@ -1840,7 +1843,7 @@ private Status executeListCloudBackupOperations(
1840
1843
return sender .finishWithError (
1841
1844
toStatus (
1842
1845
SpannerExceptionFactory .newSpannerException (
1843
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1846
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1844
1847
}
1845
1848
}
1846
1849
@@ -1879,7 +1882,7 @@ private Status executeListCloudDatabases(
1879
1882
return sender .finishWithError (
1880
1883
toStatus (
1881
1884
SpannerExceptionFactory .newSpannerException (
1882
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1885
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1883
1886
}
1884
1887
}
1885
1888
@@ -1918,7 +1921,7 @@ private Status executeListCloudDatabaseOperations(
1918
1921
return sender .finishWithError (
1919
1922
toStatus (
1920
1923
SpannerExceptionFactory .newSpannerException (
1921
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1924
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1922
1925
}
1923
1926
}
1924
1927
@@ -1952,7 +1955,7 @@ private Status executeRestoreCloudDatabase(
1952
1955
return sender .finishWithError (
1953
1956
toStatus (
1954
1957
SpannerExceptionFactory .newSpannerException (
1955
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1958
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1956
1959
}
1957
1960
}
1958
1961
@@ -1983,7 +1986,7 @@ private Status executeGetCloudDatabase(
1983
1986
return sender .finishWithError (
1984
1987
toStatus (
1985
1988
SpannerExceptionFactory .newSpannerException (
1986
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
1989
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
1987
1990
}
1988
1991
}
1989
1992
@@ -2011,7 +2014,7 @@ private Status executeGetOperation(
2011
2014
return sender .finishWithError (
2012
2015
toStatus (
2013
2016
SpannerExceptionFactory .newSpannerException (
2014
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
2017
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
2015
2018
}
2016
2019
}
2017
2020
@@ -2030,7 +2033,7 @@ private Status executeCancelOperation(
2030
2033
return sender .finishWithError (
2031
2034
toStatus (
2032
2035
SpannerExceptionFactory .newSpannerException (
2033
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
2036
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
2034
2037
}
2035
2038
}
2036
2039
@@ -2120,10 +2123,11 @@ private Status executeGenerateDbPartitionsRead(
2120
2123
LOGGER .log (Level .WARNING , String .format ("GenerateDbPartitionsRead failed for %s" , action ));
2121
2124
return sender .finishWithError (toStatus (e ));
2122
2125
} catch (Exception e ) {
2126
+ LOGGER .log (Level .WARNING , "Unexpected error: " + e .getMessage ());
2123
2127
return sender .finishWithError (
2124
2128
toStatus (
2125
2129
SpannerExceptionFactory .newSpannerException (
2126
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
2130
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
2127
2131
}
2128
2132
}
2129
2133
@@ -2166,10 +2170,11 @@ private Status executeGenerateDbPartitionsQuery(
2166
2170
LOGGER .log (Level .WARNING , String .format ("GenerateDbPartitionsQuery failed for %s" , action ));
2167
2171
return sender .finishWithError (toStatus (e ));
2168
2172
} catch (Exception e ) {
2173
+ LOGGER .log (Level .WARNING , "Unexpected error: " + e .getMessage ());
2169
2174
return sender .finishWithError (
2170
2175
toStatus (
2171
2176
SpannerExceptionFactory .newSpannerException (
2172
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
2177
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
2173
2178
}
2174
2179
}
2175
2180
@@ -2198,10 +2203,11 @@ private Status executeExecutePartition(
2198
2203
} catch (SpannerException e ) {
2199
2204
return sender .finishWithError (toStatus (e ));
2200
2205
} catch (Exception e ) {
2206
+ LOGGER .log (Level .WARNING , "Unexpected error: " + e .getMessage ());
2201
2207
return sender .finishWithError (
2202
2208
toStatus (
2203
2209
SpannerExceptionFactory .newSpannerException (
2204
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
2210
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
2205
2211
}
2206
2212
}
2207
2213
@@ -2225,10 +2231,11 @@ private Status executePartitionedUpdate(
2225
2231
} catch (SpannerException e ) {
2226
2232
return sender .finishWithError (toStatus (e ));
2227
2233
} catch (Exception e ) {
2234
+ LOGGER .log (Level .WARNING , "Unexpected error: " + e .getMessage ());
2228
2235
return sender .finishWithError (
2229
2236
toStatus (
2230
2237
SpannerExceptionFactory .newSpannerException (
2231
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
2238
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
2232
2239
}
2233
2240
}
2234
2241
@@ -2478,10 +2485,11 @@ private Status executeStartTxn(
2478
2485
} catch (SpannerException e ) {
2479
2486
return sender .finishWithError (toStatus (e ));
2480
2487
} catch (Exception e ) {
2488
+ LOGGER .log (Level .WARNING , "Unexpected error: " + e .getMessage ());
2481
2489
return sender .finishWithError (
2482
2490
toStatus (
2483
2491
SpannerExceptionFactory .newSpannerException (
2484
- ErrorCode .INVALID_ARGUMENT , "Unexpected error: " + e . getMessage ( ))));
2492
+ ErrorCode .INVALID_ARGUMENT , CloudClientExecutor . unexpectedExceptionResponse ( e ))));
2485
2493
}
2486
2494
}
2487
2495
0 commit comments