@@ -7126,7 +7126,7 @@ describe('Operation (Promises)', function() {
7126
7126
return client . withSession ( session => {
7127
7127
function commit ( ) {
7128
7128
return session . commitTransaction ( ) . catch ( e => {
7129
- if ( e . errorLabels && e . errorLabels . indexOf ( 'UnknownTransactionCommitResult' ) < 0 ) {
7129
+ if ( e . hasErrorLabel ( 'UnknownTransactionCommitResult' ) ) {
7130
7130
// LINE console.log('Transaction aborted. Caught exception during transaction.');
7131
7131
return commit ( ) ;
7132
7132
}
@@ -7184,7 +7184,7 @@ describe('Operation (Promises)', function() {
7184
7184
// LINE console.log('Transaction aborted. Caught exception during transaction.');
7185
7185
7186
7186
// If transient error, retry the whole transaction
7187
- if ( error . errorLabels && error . errorLabels . indexOf ( 'TransientTransactionError' ) < 0 ) {
7187
+ if ( error . hasErrorLabel ( 'TransientTransactionError' ) ) {
7188
7188
// LINE console.log('TransientTransactionError, retrying transaction ...');
7189
7189
return runTransactionWithRetry ( txnFunc , client , session ) ;
7190
7190
}
@@ -7246,10 +7246,7 @@ describe('Operation (Promises)', function() {
7246
7246
. commitTransaction ( )
7247
7247
// LINE .then(() => console.log('Transaction committed.'))
7248
7248
. catch ( error => {
7249
- if (
7250
- error . errorLabels &&
7251
- error . errorLabels . indexOf ( 'UnknownTransactionCommitResult' ) < 0
7252
- ) {
7249
+ if ( error . hasErrorLabel ( 'UnknownTransactionCommitResult' ) ) {
7253
7250
// LINE console.log('UnknownTransactionCommitResult, retrying commit operation ...');
7254
7251
return commitWithRetry ( session ) ;
7255
7252
}
@@ -7310,10 +7307,7 @@ describe('Operation (Promises)', function() {
7310
7307
. commitTransaction ( )
7311
7308
// LINE .then(() => console.log('Transaction committed.'))
7312
7309
. catch ( error => {
7313
- if (
7314
- error . errorLabels &&
7315
- error . errorLabels . indexOf ( 'UnknownTransactionCommitResult' ) < 0
7316
- ) {
7310
+ if ( error . hasErrorLabel ( 'UnknownTransactionCommitResult' ) ) {
7317
7311
// LINE console.log('UnknownTransactionCommitResult, retrying commit operation ...');
7318
7312
return commitWithRetry ( session ) ;
7319
7313
}
@@ -7328,7 +7322,7 @@ describe('Operation (Promises)', function() {
7328
7322
// LINE console.log('Transaction aborted. Caught exception during transaction.');
7329
7323
7330
7324
// If transient error, retry the whole transaction
7331
- if ( error . errorLabels && error . errorLabels . indexOf ( 'TransientTransactionError' ) < 0 ) {
7325
+ if ( error . hasErrorLabel ( 'TransientTransactionError' ) ) {
7332
7326
// LINE console.log('TransientTransactionError, retrying transaction ...');
7333
7327
return runTransactionWithRetry ( txnFunc , client , session ) ;
7334
7328
}
0 commit comments