Closed jordalgo closed 8 years ago
See PR #104 as an implementation for Errors in flyd streams.
Also, you can already subscribe to end -- it is a flyd stream
var s = flyd.stream(0)
flyd.on(() => console.log('STREAM HAS ENDED!'), s.end);
s.end(true);
In the pull request, instead of adding another stream, it takes the stance of an unopinionated Either value with a nice API for access within the stream.
@c-dante That is awesome! I was just mentioning how I wanted to use Either to propagate errors in most.js. Also, yes, I forgot you can subscribe to the end streams (being that they are just streams). I'll comment directly on that PR cause I agree that it's a good way to go for this lib.
@paldepind Was curious what you thought in terms of adding more fine-grained listening/subscribing into the streams, similar to a node streams approach e.g.
Streams could have an additional error stream to add to their end stream. This will definitely make them a bit more complicated but it might be a nice addition as there isn't really a way to notify stream subscribers that an error has occurred (or even that an end has occurred) with continuous checking the status of the stream.