Skip to content

Commit

Permalink
fixup! Tweak the README a bit to have an example first
Browse files Browse the repository at this point in the history
  • Loading branch information
arichiardi committed Dec 3, 2018
1 parent 8f99e2b commit e0941a1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ This example illustrates `fonda`'s basic mechanics:

;; on-success
(fn [ctx]
(do-success (:github-things ctx)))
(handle-success (:github-things ctx)))

;; on-error
(fn [error]
(do-error error)))
;; on-exception
(fn [exception]
(handle-exception exception)))
```

Fonda sequentially executes a series of [steps](#trivia), one after the other, augmenting a context map. The steps can be synchronous or asyncronous. After the steps are run, the termination callbacks will be executed.
Expand All @@ -49,7 +49,7 @@ Fonda sequentially executes a series of [steps](#trivia), one after the other, a
If a `js/Error`, an exception in `fonda` parlance, is thrown it will be automatically caught and the chain short circuits. Then the following things happen in order:

* The `log-exception` function is called, if present, with the [log map](#log-map).
* The `on-error` function is called with the `js/Error`.
* The `on-exception` function is called with the `js/Error`.

Exceptions are things we can't and don't want to recover from, like unexpected bugs.

Expand Down Expand Up @@ -165,15 +165,15 @@ The **log map** is a record that contains:

;; on-success
(fn [{:keys [remote-thing-processed]}]
(call-on-success-cb remote-thing-processed))
(handle-success remote-thing-processed))

;; on-anomaly
(fn [anomaly]
(call-on-anomaly-cb anomaly))
(handle-anomaly anomaly))

;; on-error
(fn [error]
(call-on-error-cb error)))
;; on-exception
(fn [exception]
(handle-exception exception)))

```

Expand Down

0 comments on commit e0941a1

Please sign in to comment.