Skip to content

v2.1.0 (2025-04-29)

Latest
Compare
Choose a tag to compare
@ptaoussanis ptaoussanis released this 29 Apr 19:43
· 5 commits to master since this release

This is a major rewrite of Truss that expands the library's scope, and modernises its implementation. There are breaking changes to the ex-data produced by the 4x assertion macros (have, have?, have!, have!?) in Truss and Encore.

This should be a non-breaking update for folks not using assertion ex-data, but please ping me if you run into any unexpected trouble. Apologies for the inconvenience! - Peter Taoussanis 🙏

CHANGES since v1.x

Deprecated assertion API

Changes to assertion ex-data

By default, Truss throws an ex-info exception on assertion failures. The included ex-data has changed!

Old ex-data (Truss v1):

:pred ------ (Unchanged) Predicate form
:arg ------- (Unchanged) {:keys [form value type]}

:dt -------- `js/Error` or `java.util.Date`
:loc ------- {:keys [ns line column]}
:data ------ {:keys [arg dynamic]}

:env ------- {:keys [elidable? *assert*]}
:msg ------- String
:err ------- Error thrown during pred check

New ex-data (Truss v2):

:pred ------ (Unchanged) Predicate form
:arg ------- (Unchanged) {:keys [form value type]}

:inst ------ `js/Error` or `java.time.Instant` (note type change!)
:ns -------- Namespace string
:coords ---- ?[line column]
:data ------ Optional `:data` value (replaces :data/arg)
:truss/ctx - `truss/*ctx*` value (replaces :data/dynamic)

:msg ------- REMOVED (use `ex-message` instead)
:error ----- REMOVED (use `ex-cause`   instead)
  • You can customise ex-data by modifying *failed-assertion-handler*.
  • You can keep the old ex-data by setting the taoensso.truss.legacy-assertion-ex-data JVM property to true.

New since v1.x

Since v2.0.0

  • [doc] Document arg given to *failed-assertion-handler* [7de9a82] (v2.1.0)
  • [fix] set-error-fn! should convert from v2 to v1 handler arg [d6bc7c5] (v2.1.0)
  • [fix] Fix broken Clj set-error-fn! [e99fe6b] (v2.0.6)