@@ -338,8 +338,8 @@ class Firestore extends commonGrpc.Service {
338
338
* 'Proto3 JSON' and 'Protobuf JS' encoded data.
339
339
*
340
340
* @private
341
- * @param {object } documentOrName - The Firestore 'Document' proto or the
342
- * resource name of a missing document.
341
+ * @param {object|string } documentOrName - The Firestore 'Document' proto or
342
+ * the resource name of a missing document.
343
343
* @param {object= } readTime - A 'Timestamp' proto indicating the time this
344
344
* document was read.
345
345
* @param {string= } encoding - One of 'json' or 'protobufJS'. Applies to both
@@ -487,27 +487,27 @@ class Firestore extends commonGrpc.Service {
487
487
} ) ;
488
488
} )
489
489
. then ( ( ) => {
490
- return transaction . commit ( ) . catch ( err => {
491
- if ( attemptsRemaining > 0 ) {
490
+ return transaction
491
+ . commit ( )
492
+ . then ( ( ) => result )
493
+ . catch ( err => {
494
+ if ( attemptsRemaining > 0 ) {
495
+ Firestore . log (
496
+ 'Firestore.runTransaction' ,
497
+ `Retrying transaction after error: ${ JSON . stringify ( err ) } .`
498
+ ) ;
499
+ return this . runTransaction ( updateFunction , {
500
+ previousTransaction : transaction ,
501
+ maxAttempts : attemptsRemaining ,
502
+ } ) ;
503
+ }
492
504
Firestore . log (
493
505
'Firestore.runTransaction' ,
494
- `Retrying transaction after error: ${ JSON . stringify ( err ) } .`
506
+ 'Exhausted transaction retries, returning error: %s' ,
507
+ err
495
508
) ;
496
- return this . runTransaction ( updateFunction , {
497
- previousTransaction : transaction ,
498
- maxAttempts : attemptsRemaining ,
499
- } ) ;
500
- }
501
- Firestore . log (
502
- 'Firestore.runTransaction' ,
503
- 'Exhausted transaction retries, returning error: %s' ,
504
- err
505
- ) ;
506
- return Promise . reject ( err ) ;
507
- } ) ;
508
- } )
509
- . then ( ( ) => {
510
- return result ;
509
+ return Promise . reject ( err ) ;
510
+ } ) ;
511
511
} ) ;
512
512
}
513
513
0 commit comments