@@ -31,7 +31,7 @@ import type {
31
31
import { Transform } from 'stream' ;
32
32
import * as protos from '../../protos/protos' ;
33
33
import jsonProtos = require( '../../protos/protos.json' ) ;
34
- import { loggingUtils as logging } from 'google-gax' ;
34
+ import { loggingUtils as logging , decodeAnyProtosInArray } from 'google-gax' ;
35
35
36
36
/**
37
37
* Client JSON configuration object, loaded from
@@ -267,7 +267,7 @@ export class DatabaseAdminClient {
267
267
) ,
268
268
} ;
269
269
270
- const protoFilesRoot = this . _gaxModule . protobuf . Root . fromJSON ( jsonProtos ) ;
270
+ const protoFilesRoot = this . _gaxModule . protobufFromJSON ( jsonProtos ) ;
271
271
// This API contains "long-running operations", which return a
272
272
// an Operation object that allows for tracking of the operation,
273
273
// rather than holding a request open.
@@ -710,7 +710,23 @@ export class DatabaseAdminClient {
710
710
this . _log . info ( 'getDatabase response %j' , response ) ;
711
711
return [ response , options , rawResponse ] ;
712
712
} ,
713
- ) ;
713
+ )
714
+ . catch ( ( error : any ) => {
715
+ if (
716
+ error &&
717
+ 'statusDetails' in error &&
718
+ error . statusDetails instanceof Array
719
+ ) {
720
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
721
+ jsonProtos ,
722
+ ) as unknown as gax . protobuf . Type ;
723
+ error . statusDetails = decodeAnyProtosInArray (
724
+ error . statusDetails ,
725
+ protos ,
726
+ ) ;
727
+ }
728
+ throw error ;
729
+ } ) ;
714
730
}
715
731
/**
716
732
* Drops (aka deletes) a Cloud Spanner database.
@@ -833,7 +849,23 @@ export class DatabaseAdminClient {
833
849
this . _log . info ( 'dropDatabase response %j' , response ) ;
834
850
return [ response , options , rawResponse ] ;
835
851
} ,
836
- ) ;
852
+ )
853
+ . catch ( ( error : any ) => {
854
+ if (
855
+ error &&
856
+ 'statusDetails' in error &&
857
+ error . statusDetails instanceof Array
858
+ ) {
859
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
860
+ jsonProtos ,
861
+ ) as unknown as gax . protobuf . Type ;
862
+ error . statusDetails = decodeAnyProtosInArray (
863
+ error . statusDetails ,
864
+ protos ,
865
+ ) ;
866
+ }
867
+ throw error ;
868
+ } ) ;
837
869
}
838
870
/**
839
871
* Returns the schema of a Cloud Spanner database as a list of formatted
@@ -962,7 +994,23 @@ export class DatabaseAdminClient {
962
994
this . _log . info ( 'getDatabaseDdl response %j' , response ) ;
963
995
return [ response , options , rawResponse ] ;
964
996
} ,
965
- ) ;
997
+ )
998
+ . catch ( ( error : any ) => {
999
+ if (
1000
+ error &&
1001
+ 'statusDetails' in error &&
1002
+ error . statusDetails instanceof Array
1003
+ ) {
1004
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
1005
+ jsonProtos ,
1006
+ ) as unknown as gax . protobuf . Type ;
1007
+ error . statusDetails = decodeAnyProtosInArray (
1008
+ error . statusDetails ,
1009
+ protos ,
1010
+ ) ;
1011
+ }
1012
+ throw error ;
1013
+ } ) ;
966
1014
}
967
1015
/**
968
1016
* Sets the access control policy on a database or backup resource.
@@ -1086,7 +1134,23 @@ export class DatabaseAdminClient {
1086
1134
this . _log . info ( 'setIamPolicy response %j' , response ) ;
1087
1135
return [ response , options , rawResponse ] ;
1088
1136
} ,
1089
- ) ;
1137
+ )
1138
+ . catch ( ( error : any ) => {
1139
+ if (
1140
+ error &&
1141
+ 'statusDetails' in error &&
1142
+ error . statusDetails instanceof Array
1143
+ ) {
1144
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
1145
+ jsonProtos ,
1146
+ ) as unknown as gax . protobuf . Type ;
1147
+ error . statusDetails = decodeAnyProtosInArray (
1148
+ error . statusDetails ,
1149
+ protos ,
1150
+ ) ;
1151
+ }
1152
+ throw error ;
1153
+ } ) ;
1090
1154
}
1091
1155
/**
1092
1156
* Gets the access control policy for a database or backup resource.
@@ -1203,7 +1267,23 @@ export class DatabaseAdminClient {
1203
1267
this . _log . info ( 'getIamPolicy response %j' , response ) ;
1204
1268
return [ response , options , rawResponse ] ;
1205
1269
} ,
1206
- ) ;
1270
+ )
1271
+ . catch ( ( error : any ) => {
1272
+ if (
1273
+ error &&
1274
+ 'statusDetails' in error &&
1275
+ error . statusDetails instanceof Array
1276
+ ) {
1277
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
1278
+ jsonProtos ,
1279
+ ) as unknown as gax . protobuf . Type ;
1280
+ error . statusDetails = decodeAnyProtosInArray (
1281
+ error . statusDetails ,
1282
+ protos ,
1283
+ ) ;
1284
+ }
1285
+ throw error ;
1286
+ } ) ;
1207
1287
}
1208
1288
/**
1209
1289
* Returns permissions that the caller has on the specified database or backup
@@ -1324,7 +1404,23 @@ export class DatabaseAdminClient {
1324
1404
this . _log . info ( 'testIamPermissions response %j' , response ) ;
1325
1405
return [ response , options , rawResponse ] ;
1326
1406
} ,
1327
- ) ;
1407
+ )
1408
+ . catch ( ( error : any ) => {
1409
+ if (
1410
+ error &&
1411
+ 'statusDetails' in error &&
1412
+ error . statusDetails instanceof Array
1413
+ ) {
1414
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
1415
+ jsonProtos ,
1416
+ ) as unknown as gax . protobuf . Type ;
1417
+ error . statusDetails = decodeAnyProtosInArray (
1418
+ error . statusDetails ,
1419
+ protos ,
1420
+ ) ;
1421
+ }
1422
+ throw error ;
1423
+ } ) ;
1328
1424
}
1329
1425
/**
1330
1426
* Gets metadata on a pending or completed
@@ -1443,7 +1539,23 @@ export class DatabaseAdminClient {
1443
1539
this . _log . info ( 'getBackup response %j' , response ) ;
1444
1540
return [ response , options , rawResponse ] ;
1445
1541
} ,
1446
- ) ;
1542
+ )
1543
+ . catch ( ( error : any ) => {
1544
+ if (
1545
+ error &&
1546
+ 'statusDetails' in error &&
1547
+ error . statusDetails instanceof Array
1548
+ ) {
1549
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
1550
+ jsonProtos ,
1551
+ ) as unknown as gax . protobuf . Type ;
1552
+ error . statusDetails = decodeAnyProtosInArray (
1553
+ error . statusDetails ,
1554
+ protos ,
1555
+ ) ;
1556
+ }
1557
+ throw error ;
1558
+ } ) ;
1447
1559
}
1448
1560
/**
1449
1561
* Updates a pending or completed
@@ -1572,7 +1684,23 @@ export class DatabaseAdminClient {
1572
1684
this . _log . info ( 'updateBackup response %j' , response ) ;
1573
1685
return [ response , options , rawResponse ] ;
1574
1686
} ,
1575
- ) ;
1687
+ )
1688
+ . catch ( ( error : any ) => {
1689
+ if (
1690
+ error &&
1691
+ 'statusDetails' in error &&
1692
+ error . statusDetails instanceof Array
1693
+ ) {
1694
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
1695
+ jsonProtos ,
1696
+ ) as unknown as gax . protobuf . Type ;
1697
+ error . statusDetails = decodeAnyProtosInArray (
1698
+ error . statusDetails ,
1699
+ protos ,
1700
+ ) ;
1701
+ }
1702
+ throw error ;
1703
+ } ) ;
1576
1704
}
1577
1705
/**
1578
1706
* Deletes a pending or completed
@@ -1694,7 +1822,23 @@ export class DatabaseAdminClient {
1694
1822
this . _log . info ( 'deleteBackup response %j' , response ) ;
1695
1823
return [ response , options , rawResponse ] ;
1696
1824
} ,
1697
- ) ;
1825
+ )
1826
+ . catch ( ( error : any ) => {
1827
+ if (
1828
+ error &&
1829
+ 'statusDetails' in error &&
1830
+ error . statusDetails instanceof Array
1831
+ ) {
1832
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
1833
+ jsonProtos ,
1834
+ ) as unknown as gax . protobuf . Type ;
1835
+ error . statusDetails = decodeAnyProtosInArray (
1836
+ error . statusDetails ,
1837
+ protos ,
1838
+ ) ;
1839
+ }
1840
+ throw error ;
1841
+ } ) ;
1698
1842
}
1699
1843
/**
1700
1844
* Adds split points to specified tables, indexes of a database.
@@ -1829,7 +1973,23 @@ export class DatabaseAdminClient {
1829
1973
this . _log . info ( 'addSplitPoints response %j' , response ) ;
1830
1974
return [ response , options , rawResponse ] ;
1831
1975
} ,
1832
- ) ;
1976
+ )
1977
+ . catch ( ( error : any ) => {
1978
+ if (
1979
+ error &&
1980
+ 'statusDetails' in error &&
1981
+ error . statusDetails instanceof Array
1982
+ ) {
1983
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
1984
+ jsonProtos ,
1985
+ ) as unknown as gax . protobuf . Type ;
1986
+ error . statusDetails = decodeAnyProtosInArray (
1987
+ error . statusDetails ,
1988
+ protos ,
1989
+ ) ;
1990
+ }
1991
+ throw error ;
1992
+ } ) ;
1833
1993
}
1834
1994
/**
1835
1995
* Creates a new backup schedule.
@@ -1960,7 +2120,23 @@ export class DatabaseAdminClient {
1960
2120
this . _log . info ( 'createBackupSchedule response %j' , response ) ;
1961
2121
return [ response , options , rawResponse ] ;
1962
2122
} ,
1963
- ) ;
2123
+ )
2124
+ . catch ( ( error : any ) => {
2125
+ if (
2126
+ error &&
2127
+ 'statusDetails' in error &&
2128
+ error . statusDetails instanceof Array
2129
+ ) {
2130
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
2131
+ jsonProtos ,
2132
+ ) as unknown as gax . protobuf . Type ;
2133
+ error . statusDetails = decodeAnyProtosInArray (
2134
+ error . statusDetails ,
2135
+ protos ,
2136
+ ) ;
2137
+ }
2138
+ throw error ;
2139
+ } ) ;
1964
2140
}
1965
2141
/**
1966
2142
* Gets backup schedule for the input schedule name.
@@ -2087,7 +2263,23 @@ export class DatabaseAdminClient {
2087
2263
this . _log . info ( 'getBackupSchedule response %j' , response ) ;
2088
2264
return [ response , options , rawResponse ] ;
2089
2265
} ,
2090
- ) ;
2266
+ )
2267
+ . catch ( ( error : any ) => {
2268
+ if (
2269
+ error &&
2270
+ 'statusDetails' in error &&
2271
+ error . statusDetails instanceof Array
2272
+ ) {
2273
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
2274
+ jsonProtos ,
2275
+ ) as unknown as gax . protobuf . Type ;
2276
+ error . statusDetails = decodeAnyProtosInArray (
2277
+ error . statusDetails ,
2278
+ protos ,
2279
+ ) ;
2280
+ }
2281
+ throw error ;
2282
+ } ) ;
2091
2283
}
2092
2284
/**
2093
2285
* Updates a backup schedule.
@@ -2220,7 +2412,23 @@ export class DatabaseAdminClient {
2220
2412
this . _log . info ( 'updateBackupSchedule response %j' , response ) ;
2221
2413
return [ response , options , rawResponse ] ;
2222
2414
} ,
2223
- ) ;
2415
+ )
2416
+ . catch ( ( error : any ) => {
2417
+ if (
2418
+ error &&
2419
+ 'statusDetails' in error &&
2420
+ error . statusDetails instanceof Array
2421
+ ) {
2422
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
2423
+ jsonProtos ,
2424
+ ) as unknown as gax . protobuf . Type ;
2425
+ error . statusDetails = decodeAnyProtosInArray (
2426
+ error . statusDetails ,
2427
+ protos ,
2428
+ ) ;
2429
+ }
2430
+ throw error ;
2431
+ } ) ;
2224
2432
}
2225
2433
/**
2226
2434
* Deletes a backup schedule.
@@ -2347,7 +2555,23 @@ export class DatabaseAdminClient {
2347
2555
this . _log . info ( 'deleteBackupSchedule response %j' , response ) ;
2348
2556
return [ response , options , rawResponse ] ;
2349
2557
} ,
2350
- ) ;
2558
+ )
2559
+ . catch ( ( error : any ) => {
2560
+ if (
2561
+ error &&
2562
+ 'statusDetails' in error &&
2563
+ error . statusDetails instanceof Array
2564
+ ) {
2565
+ const protos = this . _gaxModule . protobuf . Root . fromJSON (
2566
+ jsonProtos ,
2567
+ ) as unknown as gax . protobuf . Type ;
2568
+ error . statusDetails = decodeAnyProtosInArray (
2569
+ error . statusDetails ,
2570
+ protos ,
2571
+ ) ;
2572
+ }
2573
+ throw error ;
2574
+ } ) ;
2351
2575
}
2352
2576
2353
2577
/**
0 commit comments