All Projects → alexanderkiel → async-error

alexanderkiel / async-error

Licence: EPL-1.0 license
A Clojure(Script) library which provides core.async error handling utilities.

Programming Languages

clojure
4091 projects

Async Error

Build Status Dependencies Status cljdoc

A Clojure(Script) library which provides core.async error handling utilities.

Install

To install, just add the following to your project dependencies:

[org.clojars.akiel/async-error "0.3"]

Needs at least core.async v0.3.465!

Usage

In Clojure

(:require [async-error.core :refer [go-try <?]])

In ClojureScript

(:require [async-error.core :refer-macros [go-try <?]])

In Clojure and ClojureScript

(defn read-both [ch-a ch-b]
  (go-try
    (let [a (<? ch-a)
          b (<? ch-b)]
      [a b])))

This function returns a channel conveying either a vector of a and b or one of the errors conveyed by ch-a or ch-b. It will never read from ch-b if ch-a returns an error.

Related Work

License

Copyright © 2015 Alexander Kiel

Distributed under the Eclipse Public License, the same as Clojure.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].