File tree Expand file tree Collapse file tree 4 files changed +240
-57
lines changed Expand file tree Collapse file tree 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
1212.DS_Store
1313package-lock.json
1414__pycache__
15+ .vscode
Original file line number Diff line number Diff line change @@ -712,8 +712,16 @@ export class Snapshot extends EventEmitter {
712712 this . _update ( response . metadata ! . transaction ) ;
713713 }
714714 } )
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+ ) {
717725 this . begin ( ) ;
718726 }
719727 } ) ;
@@ -1219,8 +1227,16 @@ export class Snapshot extends EventEmitter {
12191227 this . _update ( response . metadata ! . transaction ) ;
12201228 }
12211229 } )
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+ ) {
12241240 this . begin ( ) ;
12251241 }
12261242 } ) ;
@@ -1437,6 +1453,7 @@ export class Snapshot extends EventEmitter {
14371453 this . _waitingRequests . push ( ( ) => {
14381454 makeRequest ( resumeToken )
14391455 . on ( 'data' , chunk => streamProxy . emit ( 'data' , chunk ) )
1456+ . on ( 'error' , err => streamProxy . emit ( 'error' , err ) )
14401457 . on ( 'end' , ( ) => streamProxy . emit ( 'end' ) ) ;
14411458 } ) ;
14421459
Original file line number Diff line number Diff line change @@ -540,6 +540,7 @@ export class MockSpanner {
540540 call . request ! . transaction . id
541541 } `;
542542 if ( this . abortedTransactions . has ( fullTransactionId ) ) {
543+ call . sendMetadata ( new Metadata ( ) ) ;
543544 call . emit (
544545 'error' ,
545546 MockSpanner . createTransactionAbortedError ( `${ fullTransactionId } ` )
@@ -556,6 +557,7 @@ export class MockSpanner {
556557 call . request ! . transaction . begin
557558 ) ;
558559 if ( txn instanceof Error ) {
560+ call . sendMetadata ( new Metadata ( ) ) ;
559561 call . emit ( 'error' , txn ) ;
560562 call . end ( ) ;
561563 return ;
@@ -593,6 +595,7 @@ export class MockSpanner {
593595 index
594596 ) ;
595597 if ( streamErr ) {
598+ call . sendMetadata ( new Metadata ( ) ) ;
596599 call . emit ( 'error' , streamErr ) ;
597600 break ;
598601 }
@@ -610,6 +613,7 @@ export class MockSpanner {
610613 1
611614 ) ;
612615 if ( streamErr ) {
616+ call . sendMetadata ( new Metadata ( ) ) ;
613617 call . emit ( 'error' , streamErr ) ;
614618 break ;
615619 }
You can’t perform that action at this time.
0 commit comments