https://github.com/jtkdvlp/core.async-helpers
Helper pack for core.async
https://github.com/jtkdvlp/core.async-helpers
async callback clojure clojurescript error-handling error-propagation exception-handling promise
Last synced: about 2 months ago
JSON representation
Helper pack for core.async
- Host: GitHub
- URL: https://github.com/jtkdvlp/core.async-helpers
- Owner: jtkDvlp
- License: epl-2.0
- Created: 2020-08-20T21:53:27.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-02-05T22:10:44.000Z (4 months ago)
- Last Synced: 2025-03-25T11:49:11.056Z (2 months ago)
- Topics: async, callback, clojure, clojurescript, error-handling, error-propagation, exception-handling, promise
- Language: Clojure
- Homepage:
- Size: 42 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://clojars.org/jtk-dvlp/core.async-helpers)
[](https://cljdoc.org/d/jtk-dvlp/core.async-helpers/CURRENT)
[](https://opensource.org/licenses/EPL-2.0)
[](https://www.paypal.com/donate?hosted_button_id=2PDXQMHX56T6U)# Helpers for core.async
Helper pack for [core.async](https://github.com/clojure/core.async) with focus on error propagation, see [docs](https://cljdoc.org/d/jtk-dvlp/core.async-helpers/CURRENT) for more and examples.
## Features
* error propagation by climbing up the go block stack via [go](https://cljdoc.org/d/jtk-dvlp/core.async-helpers/CURRENT/api/jtk-dvlp.async#go) / [go-loop](https://cljdoc.org/d/jtk-dvlp/core.async-helpers/CURRENT/api/jtk-dvlp.async#go-loop) / [map](https://cljdoc.org/d/jtk-dvlp/core.async-helpers/CURRENT/api/jtk-dvlp.async#map) / [reduce](https://cljdoc.org/d/jtk-dvlp/core.async-helpers/CURRENT/api/jtk-dvlp.async#reduce) / [promise-chan](https://cljdoc.org/d/jtk-dvlp/core.async-helpers/CURRENT/api/jtk-dvlp.async.interop.promise#->promise-chan) and its behavior
* to create promise-chan via [promise-chan](https://cljdoc.org/d/jtk-dvlp/core.async-helpers/CURRENT/api/jtk-dvlp.async.interop.promise#promise-chan) function with resolve and reject handlers
* conversion from channel to promise and vice versa via [c->p](https://cljdoc.org/d/jtk-dvlp/core.async-helpers/CURRENT/api/jtk-dvlp.async.inertop.promise#c->p), [p->c](https://cljdoc.org/d/jtk-dvlp/core.async-helpers/CURRENT/api/jtk-dvlp.async.inertop.promise#p->c) and [c](https://cljdoc.org/d/jtk-dvlp/core.async-helpers/CURRENT/api/jtk-dvlp.async.interop.callback#cb->c) and [
[](https://clojars.org/jtk-dvlp/core.async-helpers)### Usage
Pay attention mixing up error propagation functions of this library and clojure.core.async functions. clojure.core.async function do not propagate errors. E.g. using a core.async go-block within a error propagation go-block stack will break error propagation. So do not mix it up!
```clojure
(ns your-project
#?(:clj
(:require
[clojure.core.async :refer [timeout]]
[jtk-dvlp.async :as a]):cljs
(:require
[cljs.core.async :refer [timeout]]
[jtk-dvlp.async :as a]))#?(:clj
(:import
[clojure.lang ExceptionInfo])),,,)
(defn > {:call-args args}
(ex-info "you got a bug")
(throw))))(comment
(a/go
(try
(let [a
(a/