Skip to content

Commit

Permalink
fix(stream): throw error when there are no error listeners
Browse files Browse the repository at this point in the history
If an error is being propagated in a chain of streams and the current
stream has no listeners attached, xstream would previously silently
swallow the error. This allowed for buggy behavior to pass by silently.
This commit changes the Stream implementation to check, during error
propagation in a chain of stream, whether there are
no listeners attached and simply throw the error in that case.

BREAKING CHANGE:
![maybe
will](https://img.shields.io/badge/will%20it%20affect%20me%3F-maybe%20will-yellow.svg)
This changes the behavior of most xstream code because errors are no
longer swallowed. When you update xstream to this version, you may
experience new errors thrown that you haven't seen before. Upgrade
carefully, keeping in mind that these thrown errors were always there,
but only now are surfaced.

Closes issue #121
  • Loading branch information
kay-is authored and staltz committed Nov 28, 2016
1 parent 7327a9d commit e512c3e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,7 @@ export class Stream<T> implements InternalListener<T> {
const b = copy(a);
for (let i = 0; i < L; i++) b[i]._e(err);
}
if (!this._d && L == 0) throw this._err;
}

_c(): void {
Expand Down

0 comments on commit e512c3e

Please sign in to comment.