aleph

aengelberg 2017-09-15T17:28:48.000576Z

The lack of error propagation in manifold streams makes me less confident in writing servers that use stream conversion to handle incoming data. For example, I would like to write a handler that takes an InputStream, converts it into a stream of chunks (easy enough with byte-streams), then upload each of those chunks to S3 in a multipart upload. But what if the S3 API throws an error when uploading one of the chunks? The stream consumer will silently fail, but won't stop the upload. Any way to reconcile this lack of error propagation?

dm3 2017-09-15T17:50:28.000067Z

Yeah, I’ve registered an issue https://github.com/ztellman/manifold/issues/95 a while ago

dm3 2017-09-15T17:51:54.000105Z

it even references a commit with an error-propagation implementation

dm3 2017-09-15T17:52:21.000283Z

@ztellman said that his experience with Lamina proved that attaching error handling to streams is more trouble than it’s worth.

dm3 2017-09-15T17:52:38.000077Z

I disagree - for the same reasons you have, @aengelberg

dm3 2017-09-15T17:52:39.000368Z

🙂

aengelberg 2017-09-15T17:54:37.000203Z

I'm not convinced it's an easy problem to solve, either 🙂 In general, you'd ideally like to be able to both propagate errors forward and backward. e.g. If something hands you a stream, you'd like to know when the upstream processor stops due to failure. And if you hand something a stream, you'd like to know when the downstream processor fails.

dm3 2017-09-15T18:40:07.000195Z

well, I’ve implemented propagation downstream

dm3 2017-09-15T18:40:27.000592Z

upstream is a harder problem as sources don’t usually care about consumers

dm3 2017-09-15T18:41:44.000334Z

I don’t think you can really get by without the feature - in many parts of my code I’ve resorted to passing tuples of (Stream, Deferred[Error]) through combinators

dm3 2017-09-15T18:41:55.000215Z

Rx* libs have this too

shader 2017-09-15T21:56:09.000089Z

another stream library I like a lot, most.js, provides a recoverWith method: https://github.com/cujojs/most/blob/master/docs/api.md#recoverwith

shader 2017-09-15T21:56:43.000260Z

it's an interesting solution, in that the error handler function is expected to provide a replacement stream

shader 2017-09-15T21:57:40.000330Z

in their example, you fall back to default data if you can't fetch data from a server