File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change 1+ (ns your-project
2+ (:require [jtk-dvlp.async :as a]))
3+
4+
5+ (defn ?do-some-async-stuff
6+ [& args]
7+ (a/go*
8+ (Thread/sleep 1000 )
9+ (let [result
10+ {:thread-id (.getId (Thread/currentThread ))
11+ :call-args args}]
12+
13+ (println result)
14+ result)))
15+
16+ (defn ?fail-during-some-async-stuff
17+ [& args]
18+ (a/go*
19+ (Thread/sleep 1000 )
20+ (->> {:thread-id (.getId (Thread/currentThread ))
21+ :call-args args}
22+ (ex-info " you got a bug" )
23+ (throw ))))
24+
25+ (defn ?do-some-more-stuff
26+ []
27+ (a/go*
28+ (let [a
29+ (a/<e! (?do-some-async-stuff :a ))
30+
31+ b
32+ (a/<e! (?fail-during-some-async-stuff :b ))
33+
34+ c
35+ (a/<e! (?do-some-async-stuff :c ))]
36+
37+ [a b c])))
38+
39+ (comment
40+ (a/go*
41+ (try
42+ (->> (?do-some-more-stuff )
43+ (a/<e! )
44+ (println " success" ))
45+ (catch clojure.lang.ExceptionInfo e
46+ (println " there is an error" e)))))
Original file line number Diff line number Diff line change 1- (defproject jtk-dvlp /core.async-helpers " 1.1.0 "
1+ (defproject jtk-dvlp /core.async-helpers " 1.1.1 "
22 :description
33 " Helper pack for core.async"
44
You can’t perform that action at this time.
0 commit comments