-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A way to signal errors on a stream #95
Comments
I took a stab at implementing error propagation, you can take a look in the commit here. The meat of the thing is the propagate-error function. Would appreciate the comments/advice you have regarding this approach! |
Since |
Completely agree with that. However, I couldn't find a way to solve the propagation of errors from
This seems very clunky in practice, consider: (let [a (s/consume fn-a s-a), b (s/consume fn-b s-b)]
(-> (d/zip a b)
(d/chain (fn [_] (println "Done")))
(d/catch (fn [e] (println e "Couldn't consume, restarting ...") ...)))) vs (let [wrap (fn [f] #(try (f %)
(catch Throwable t (println t "Couldn't consume, restarting ...") ...)))
a (s/consume (wrap fn-a) s-a), b (s/consume (wrap fn-b s-b) s-b)]
(-> (d/zip a b)
(c/chain (fn [_] (println "Done"))))) It's not too bad, but there's some inconsistency in losing the ability to |
I missed the possibility to easily wrap my stream with a catch while I was developing an SSE endpoint. I didn't know exactly where I had to look for the exception. In the end I figured it out with the logging functionality. However I can see how this would be problematic in production where you often want errors to end up elsewhere (e.g. an exception notifier) so one can react on it quicker and monitor how often that specific error happens. Maybe this can also be done via |
Some graphics I made on #aleph slack in relation to a discussion about error handling - didn't get any response from @ztellman at a time, so attaching here. |
i'm currently having some issues with error propagation - in particular i'd like to be able to have errors which happen during a i'm currently looking at creating some chunked versions of |
Currently there's no mechanism to propagate errors which happen in the stream transforming functions. The only option currently is to log the error and close the output stream.
I often find myself attaching an error-carrying deferred at each stream transformation point,
deferred/connect
ed to error-carrying deferreds downstream. This way I have a way to react to the abnormal stream termination.What do you think about adding a
stream/catch
orstream/on-error
or possiblystream/error-deferred
which would give access to the error?The text was updated successfully, but these errors were encountered: