A lightweight, dependency-free library for Clojure/Script that provides inline assertions and contextual exceptions to improve error messages.
Truss is a lightweight, dependency-free library for Clojure and ClojureScript that provides inline assertions and contextual exceptions to improve error messages. It solves the problem of Clojure's impenetrable error messages by offering practical tools for runtime validation and debugging.
Clojure and ClojureScript developers who need better error handling and debugging capabilities, especially those working on production systems where unclear errors are costly.
Developers choose Truss for its minimal overhead, cross-platform support, and opinionated design that delivers high-value error handling utilities without bloat, making it easy to integrate and use.
Micro toolkit for Clojure/Script errors
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The `have` macro throws exceptions with predicates, argument values, and source location, as shown in examples where failures include timestamps and contextual data.
Dynamic context via `*ctx*` is automatically included in `truss/ex-info` exceptions, making it easy to debug Ring handlers by attaching request data.
Utilities like `catching` and `try*` provide uniform exception handling across Clojure and ClojureScript, simplifying codebases targeting both platforms.
Includes `throws?` and `matching-error` for unit testing exceptions and their ex-data, allowing precise validation of error conditions.
Using contextual exceptions requires explicit setup with `set-ctx!` or `with-ctx`, adding boilerplate code that can be error-prone.
Focuses on assertion and context enrichment but lacks built-in mechanisms for error recovery, retry logic, or integration with broader error handling systems.
Runtime assertions introduce overhead, which may impact performance in hot code paths or loops, and there's no built-in way to disable them for production.