v2.0.0 (2025-02-27)
- 📦 Dependency: on Clojars
- Versioning: Break Versioning
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 is a non-breaking update for folks not using assertion ex-data.
Apologies for any inconvenience! - Peter Taoussanis 🙏
CHANGES since v1.x
Deprecated assertion API
set-error-fn!
andwith-error-fn
have been deprecated. Please use*failed-assertion-handler*
instead.get-data
andwith-data
have been deprecated. Please use*ctx*
instead.
Changes to assertion ex-data
The ex-data included in assertion failures has changed!
Old ex-data:
: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:
:pred ------ (Unchanged) Predicate form
:arg ------- (Unchanged) {:keys [form value type]}
:inst ------ `js/Error` or `java.time.Instant`
: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 totrue
.
New since v1.x
-
Significant performance and expansion size improvements to the assertions API (
have
,have?
,have!
,have!?
). Esp. useful for ClojureScript codebases that use many assertions. -
Added new contextual exceptions API:
ex-info
,ex-info!
,*ctx*
,set-ctx!
,with-ctx
,with-ctx+
. -
Added new Error utils imported (moved) from Encore:
error?
,try*
,catching
,matching-error
,throws
,throws?
,catching-rf
,catching-xform
,unexpected-arg!
.