Skip to content

Commit 5c0eceb

Browse files
committedJan 7, 2021
Fixes doc strings and readme
1 parent c4874cc commit 5c0eceb

File tree

4 files changed

+15
-21
lines changed

4 files changed

+15
-21
lines changed
 

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ Add the following dependency to your `project.clj`:<br>
7575
(->> (?do-some-more-stuff)
7676
(a/<!)
7777
(println "success"))
78-
(catch #?(:clj clojure.lang.ExceptionInfo
79-
:cljs ExceptionInfo) e
78+
(catch #?(:clj Throwable
79+
:cljs :default) e
8080
(println "there is an error" e)))))
8181
```
8282

‎src/jtk_dvlp/async.cljc

+6-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424

2525
(defn chan?
26-
"Checks `x` of type channel (`clojure.core.async.impl.channels/ManyToManyChannel` / `cljs.core.async.impl.channels/ManyToManyChannel`)."
2726
[x]
2827
(instance? ManyToManyChannel x))
2928

@@ -39,7 +38,7 @@
3938

4039
#?(:clj
4140
(defmacro go
42-
"Like `core.async/go` but carries thrown exception as result."
41+
"Like `core.async/go` but carries thrown error / exception as result."
4342
[& body]
4443
(if (:ns &env)
4544
`(cljs.core.async/go
@@ -59,15 +58,15 @@
5958

6059
#?(:clj
6160
(defmacro go-loop
62-
"Like `core.async/go-loop` but carries thrown exception as result."
61+
"Like `core.async/go-loop` but carries thrown error / exception as result."
6362
[bindings & body]
6463
`(jtk-dvlp.async/go
6564
(loop ~bindings
6665
~@body))))
6766

6867
#?(:clj
6968
(defmacro <!
70-
"Like `core.async/<!` but tests taken val instance of exception, if so throws it."
69+
"Like `core.async/<!` but tests taken val of error / exception, if so throws it."
7170
[?exp]
7271
(if (:ns &env)
7372
`(let [v# (cljs.core.async/<! ~?exp)]
@@ -89,7 +88,7 @@
8988
v#))))
9089

9190
(defn map
92-
"Like `core.async/map` but carries thrown exception as result."
91+
"Like `core.async/map` but carries thrown error / exception as result."
9392
[f chs]
9493
(async/map
9594
(fn [& args]
@@ -114,7 +113,7 @@
114113
chs))
115114

116115
(defn reduce
117-
"Like `core.async/reduce` but carries thrown exception as result."
116+
"Like `core.async/reduce` but carries thrown error / exception as result."
118117
[f init ch]
119118
(async/reduce
120119
(fn [accu v]
@@ -139,6 +138,6 @@
139138
init ch))
140139

141140
(defn into
142-
"Like `core.async/into` but carries thrown exception as result."
141+
"Like `core.async/into` but carries thrown error / exception as result."
143142
[coll ch]
144143
(reduce conj coll ch))

‎src/jtk_dvlp/async/interop/callback.cljc

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
closing the channel! Otherwise channel will be closed after first put
3737
(resolve or reject).
3838
39-
If calling `exp` fails an `ExceptionInfo` will be put onto the
39+
If calling `exp` fails an error / exception will be put onto the
4040
new created channel with fail information. The channel will be
4141
closed then.
4242
@@ -64,7 +64,7 @@
6464
(<cb!)
6565
(println))
6666
67-
(catch clojure.lang.ExceptionInfo e
67+
(catch Throwable e
6868
(println e)))))
6969
```"
7070

‎src/jtk_dvlp/async/interop/promise.cljc

+5-10
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111
:cljs
1212
(:require
1313
[cljs.core.async :as async]
14-
[jtk-dvlp.async]))
15-
16-
#?(:clj
17-
(:import
18-
[clojure.lang ExceptionInfo])))
14+
[jtk-dvlp.async])))
1915

2016

2117
(defn p->c
@@ -60,8 +56,7 @@
6056

6157
(defn c->p
6258
"Creates a promise and resolves it with the val of channel `c`
63-
taken by `<!`, excepted val is an instance of `ExceptionInfo` rejects the
64-
promise. Closes the channel after took val."
59+
taken by `<!` or rejects it on error / exception. Closes the channel after took val."
6560
[c]
6661
(create-promise
6762
(fn [resolve reject]
@@ -97,9 +92,9 @@
9792
c)))
9893

9994
(defn ->promise-chan
100-
"Ensure given channel `c` to be a `promise-chan` via
101-
`pipe` it into a new `promise-chan`. See `core.async/promise-chan`
102-
for more infos. Auto close channel `c`."
95+
"Ensure given channel `c` to be a `promise-chan`.
96+
See `core.async/promise-chan` for more infos.
97+
Auto closes channel `c`."
10398
[c]
10499
(let [p (async/promise-chan)]
105100
(async/take!

0 commit comments

Comments
 (0)
Please sign in to comment.