Skip to content

Commit 89c733e

Browse files
committed
Call observer onError only once
1 parent a65b4ae commit 89c733e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/v1/internal/stream-observer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class StreamObserver {
3939
this._queuedRecords = [];
4040
this._tail = null;
4141
this._error = null;
42+
this._hasFailed = false;
4243
}
4344

4445
/**
@@ -87,6 +88,10 @@ class StreamObserver {
8788
* @param {Object} error - An error object
8889
*/
8990
onError(error) {
91+
if(this._hasFailed) {
92+
return;
93+
}
94+
this._hasFailed = true;
9095
if( this._observer ) {
9196
if( this._observer.onError ) {
9297
this._observer.onError( error );

0 commit comments

Comments
 (0)