This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-05
Channels
- # admin-announcements (3)
- # architecture (1)
- # beginners (16)
- # boot (14)
- # cljsrn (205)
- # clojars (4)
- # clojure (100)
- # clojure-austin (2)
- # clojure-india (1)
- # clojure-poland (7)
- # clojure-russia (95)
- # clojure-spec (25)
- # clojure-uk (127)
- # clojurescript (32)
- # core-async (7)
- # cursive (2)
- # datascript (4)
- # datomic (3)
- # editors-rus (1)
- # emacs (8)
- # events (10)
- # funcool (5)
- # gorilla (2)
- # hoplon (6)
- # jobs (1)
- # lein-figwheel (7)
- # leiningen (2)
- # luminus (11)
- # om (7)
- # onyx (119)
- # other-languages (31)
- # proto-repl (1)
- # proton (37)
- # protorepl (3)
- # re-frame (60)
- # reagent (8)
- # spacemacs (9)
- # specter (21)
- # spirituality-ethics (2)
- # yada (10)
So, I’ve wondered how to go about handling errors inside go blocks. And I’ve found an interesting article that presents a nice approach. Any exception is put on the channel. And on the consumer side it uses a macro (`<?`) that takes from the channel, and if the value is a Throwable, it will throw it. https://martintrojer.github.io/clojure/2014/03/09/working-with-coreasync-exceptions-in-go-blocks
But can you really use that macro inside a go block? Wouldn’t it hide the <!
operation and prevent the go
macro from doing its magic? Am I missing something?
personally, I think doing this muddies the purpose of the channel and complicates every endpoint and is not a great idea
How do you handle that go blocks just silently swallow exceptions? I’m not very experienced with core.async, and that has been a problem for me. Currently, I register a default exception handler that at least logs those exceptions.
I would pass in to each go block an input channel, an output channel, and an error channel
usually it’s best to either handle exceptions within the go process, or report them via an error channel