This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-05
Channels
- # beginners (240)
- # boot (5)
- # cider (48)
- # clara (2)
- # cljs-dev (3)
- # cljsrn (66)
- # clojure (111)
- # clojure-denver (2)
- # clojure-italy (42)
- # clojure-nl (5)
- # clojure-spec (12)
- # clojure-uk (45)
- # clojurescript (138)
- # community-development (7)
- # core-async (8)
- # datomic (27)
- # emacs (21)
- # euroclojure (6)
- # figwheel (10)
- # fulcro (29)
- # graphql (5)
- # hoplon (3)
- # luminus (1)
- # lumo (7)
- # mount (4)
- # off-topic (13)
- # onyx (20)
- # parinfer (3)
- # pedestal (4)
- # precept (1)
- # proton (3)
- # re-frame (41)
- # reagent (3)
- # reitit (28)
- # ring-swagger (7)
- # shadow-cljs (88)
- # specter (1)
- # testing (10)
- # tools-deps (27)
- # vim (58)
I’m trying to use io.pedestal.interceptor.chain/execute
to define a pipeline of sync/async actions (outside of a regular web request). If I have a catch-all error interceptor (`{:error (fn [ctx ex] ..)}`), it works fine when I throw an exception in :enter
or :leave
, unless the enter/leave handler is async (returns a go chan
). Should it work? Or do I need a different error-handling approach for async?
I can do it explicitly with a try/catch
inside the async/go
block, but is there a better way?
:enter (fn [ctx]
(let [ch (async/chan)]
(async/go
(try+
(async/>! ch (do-some-async-work ctx))
(catch Object err
(async/>! ch (assoc ctx :io.pedestal.interceptor.chain/error
(ex-info "Async Error" err))))))
ch))
@pithyless It's supposed to use the same error handling whether you return a channel or a context. Can you share a repro case?