File tree 4 files changed +240
-57
lines changed
4 files changed +240
-57
lines changed Original file line number Diff line number Diff line change @@ -12,3 +12,4 @@ system-test/*key.json
12
12
.DS_Store
13
13
package-lock.json
14
14
__pycache__
15
+ .vscode
Original file line number Diff line number Diff line change @@ -712,8 +712,16 @@ export class Snapshot extends EventEmitter {
712
712
this . _update ( response . metadata ! . transaction ) ;
713
713
}
714
714
} )
715
- . on ( 'error' , ( ) => {
716
- if ( ! this . id && this . _useInRunner ) {
715
+ . on ( 'error' , err => {
716
+ const isServiceError = err && typeof err === 'object' && 'code' in err ;
717
+ if (
718
+ ! this . id &&
719
+ this . _useInRunner &&
720
+ ! (
721
+ isServiceError &&
722
+ ( err as grpc . ServiceError ) . code === grpc . status . ABORTED
723
+ )
724
+ ) {
717
725
this . begin ( ) ;
718
726
}
719
727
} ) ;
@@ -1219,8 +1227,16 @@ export class Snapshot extends EventEmitter {
1219
1227
this . _update ( response . metadata ! . transaction ) ;
1220
1228
}
1221
1229
} )
1222
- . on ( 'error' , ( ) => {
1223
- if ( ! this . id && this . _useInRunner ) {
1230
+ . on ( 'error' , err => {
1231
+ const isServiceError = err && typeof err === 'object' && 'code' in err ;
1232
+ if (
1233
+ ! this . id &&
1234
+ this . _useInRunner &&
1235
+ ! (
1236
+ isServiceError &&
1237
+ ( err as grpc . ServiceError ) . code === grpc . status . ABORTED
1238
+ )
1239
+ ) {
1224
1240
this . begin ( ) ;
1225
1241
}
1226
1242
} ) ;
@@ -1437,6 +1453,7 @@ export class Snapshot extends EventEmitter {
1437
1453
this . _waitingRequests . push ( ( ) => {
1438
1454
makeRequest ( resumeToken )
1439
1455
. on ( 'data' , chunk => streamProxy . emit ( 'data' , chunk ) )
1456
+ . on ( 'error' , err => streamProxy . emit ( 'error' , err ) )
1440
1457
. on ( 'end' , ( ) => streamProxy . emit ( 'end' ) ) ;
1441
1458
} ) ;
1442
1459
Original file line number Diff line number Diff line change @@ -540,6 +540,7 @@ export class MockSpanner {
540
540
call . request ! . transaction . id
541
541
} `;
542
542
if ( this . abortedTransactions . has ( fullTransactionId ) ) {
543
+ call . sendMetadata ( new Metadata ( ) ) ;
543
544
call . emit (
544
545
'error' ,
545
546
MockSpanner . createTransactionAbortedError ( `${ fullTransactionId } ` )
@@ -556,6 +557,7 @@ export class MockSpanner {
556
557
call . request ! . transaction . begin
557
558
) ;
558
559
if ( txn instanceof Error ) {
560
+ call . sendMetadata ( new Metadata ( ) ) ;
559
561
call . emit ( 'error' , txn ) ;
560
562
call . end ( ) ;
561
563
return ;
@@ -593,6 +595,7 @@ export class MockSpanner {
593
595
index
594
596
) ;
595
597
if ( streamErr ) {
598
+ call . sendMetadata ( new Metadata ( ) ) ;
596
599
call . emit ( 'error' , streamErr ) ;
597
600
break ;
598
601
}
@@ -610,6 +613,7 @@ export class MockSpanner {
610
613
1
611
614
) ;
612
615
if ( streamErr ) {
616
+ call . sendMetadata ( new Metadata ( ) ) ;
613
617
call . emit ( 'error' , streamErr ) ;
614
618
break ;
615
619
}
You can’t perform that action at this time.
0 commit comments