Any tips how to handle errors that happen inside f
in (pipeline-blocking 5 my-out-chan (map f) (to-chan my-col))
? I would like to throw an error to the caller of my code, including the number of exceptions and one of them. Should I use the undocumented ex-handler
parameter, or wrap f
in try-catch
and send exceptions to another helper channel and then check it for content before returning or, instead of a helper channel, make the try-cache return either {:data <result>}
or {:exception <the exc.>}
and then filter
the resulting channel/collection for any errors? What do people do? Thank you!!!
ex-handler
is documented in the docs for chan
Thanks! I wouldn't think of looking there.
there is how detect a blocking operation inside a go block?
that's not something you can generally detect, but if a go block is blocked that can be detected by looking at the stack traces of all running threads
found (Thread/getAllStackTraces)
. I will play with it 🙂 tnks
in most terminals Control-\
does the same thing
there's also jstack <pid>
which you can run from another terminal
(map (comp pprint seq) (vals (Thread/getAllStackTraces)))
better (doseq [trace (vals (Thread/getAllStackTraces))] (println (clojure.string/join "\n" trace)))