From 87b176a1a8b6afea2873a81934a3baa0cda6cb3a Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Mon, 21 Mar 2016 13:29:31 +0700 Subject: [PATCH] v1.2.0 --- CHANGELOG.md | 12 ++++++++---- README.md | 14 ++++++++++++-- project.clj | 4 ++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f012a9..7a52a14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,17 @@ > This project uses [Break Versioning](https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md) -## v1.1.2 - 2016 Feb 26 - -* **Hotfix**: false vals were printing as "" in error messages +## v1.2.0 - 2016 Mar 21 ```clojure -[com.taoensso/truss "1.1.2"] +[com.taoensso/truss "1.2.0"] ``` +* **New**: added `set-error-fn!` [#3] to allow easier control over how invariant violations are reported + +## v1.1.2 - 2016 Feb 26 + +* **Hotfix**: false vals were printing as "" in error messages + ## v1.1.1 - 2016 Feb 18 * **Hotfix**: remove accidental encore reference [#1] diff --git a/README.md b/README.md index 7d4c400..6db8f65 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ **[CHANGELOG]** | [API] | current [Break Version]: ```clojure -[com.taoensso/truss "1.1.2"] ; Stable +[com.taoensso/truss "1.2.0"] ; Stable ``` Want to help [support taoensso/open-source]? @@ -36,7 +36,7 @@ Want to help [support taoensso/open-source]? Add the necessary dependency to your project: ```clojure -[com.taoensso/truss "1.1.2"] +[com.taoensso/truss "1.2.0"] ``` And setup your namespace imports: @@ -357,6 +357,15 @@ No need for any special syntax or concepts, just define a function as you'd like ## FAQ +#### How can I report/log violations? + +By default, Truss just throws an **exception** on any invariant violations. You can adjust that behaviour with the `set-error-fn!` and `with-error-fn` utils. Both take an arbitrary `(fn [msg data-map])`. + +Some common usage ideas: + + * Use `with-error-fn` to capture violations during unit testing + * Use `set-error-fn!` to _log_ violations with something like [Timbre] + #### Should I annotate my whole API? **Please don't**! I'd encourage you to think of Truss assertions like **salt in good cooking**; a little can go a long way, and the need for too much salt can be a sign that something's gone wrong in the cooking. @@ -512,3 +521,4 @@ Copyright © 2015-2016 [Peter Taoussanis]. [@marick/structural-typing]: https://github.com/marick/structural-typing/ [Midje]: https://github.com/marick/Midje [challenges]: #challenges +[Timbre]: https://github.com/ptaoussanis/timbre diff --git a/project.clj b/project.clj index d955df0..8f3f44f 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject com.taoensso/truss "1.1.2" +(defproject com.taoensso/truss "1.2.0" :author "Peter Taoussanis " :description "Assertions API for Clojure/Script" :url "https://github.com/ptaoussanis/truss" @@ -36,7 +36,7 @@ :plugins [;; These must be in :dev, Ref. https://github.com/lynaghk/cljx/issues/47: [com.keminglabs/cljx "0.6.0"] - [lein-cljsbuild "1.1.2"]]}]} + [lein-cljsbuild "1.1.3"]]}]} ;; :jar-exclusions [#"\.cljx|\.DS_Store"]