aleph

mccraigmccraig 2020-12-19T11:00:29.054100Z

sadly the wrapping is not open-source atm @guswill - for no particular reason other than it's in a monorepo and it would be work to extract an oss version and maintain it

mccraigmccraig 2020-12-19T11:03:36.056600Z

what the wrapper does is define an error container record, transparently wrap consumer fns in exception handling which outputs an error container, and provide modified versions of the stream processing fns like map, transform and reduce so that errors are propagated - i.e. preserved in a container on the stream, and returned when a reduce happens

GusWill 2020-12-20T15:18:26.059300Z

Coincidentally I've found this while looking for error handling strategies: https://github.com/yapsterapp/er-cassandra/blob/5be28c1ed868c87f5d344f21880345dd65326651/src/er_cassandra/util/stream.clj

mccraigmccraig 2020-12-20T19:30:39.066900Z

haha, well i wrote that, but it's quite old... things have moved on a long way since then 🙂

1👀
mccraigmccraig 2020-12-20T19:32:59.067100Z

that's probably around the time we were realising we had a serious issue with manifold error handling - we had some cases in prod where streams were closed early with no errors, leading to downstream processes thinking that some records were gone from the input and then deleting other records to maintain consistency

GusWill 2020-12-21T21:51:09.076500Z

Almost exactly the problem we're having now...

mccraigmccraig 2020-12-22T10:18:07.076700Z

@guswill i don't have time to do a proper job and extract our promise/stream stuff to a library ... but maybe this will help - here's our wrapper code, and the tests for it :

mccraigmccraig 2020-12-22T10:18:09.076900Z

https://gist.github.com/2e026ebd3463bfd84a9a70ec3cf37e3b

mccraigmccraig 2020-12-22T10:18:21.077100Z

https://gist.github.com/edbe963f6a7ee6b55170557f474910b8

mccraigmccraig 2020-12-22T10:19:51.077300Z

in our code we replace all manifold.stream usage with the equivalent prpr.stream wrapper fn

mccraigmccraig 2020-12-22T10:21:29.077500Z

errors will be copied to the new stream for fns like map, filter, mapcat, transform while reduce will return the first error it encounters in an errored promise

GusWill 2020-12-27T01:54:36.078100Z

Sorry, I missed your messages! These are very useful, thanks a lot for sharing them!

GusWill 2020-12-27T01:58:47.078300Z

Wow, you should totally publish this as a wrapper lib; it makes manifold errors way more tractable.

mccraigmccraig 2020-12-19T11:05:46.058100Z

even given that, i prefer the manifold model of streams+promises over core.async's approach. and as you say, core.async's error handling story isn't great either

mccraigmccraig 2020-12-19T11:07:27.059200Z

given manifold's state of abandonment, and lack of support for cljs, i've started work on a replacement - it's looking promising, but it won't be ready for a while yet