Welcome! Please see the About page for a little more info on how this works.

0 votes
in Spec by

It's a common requirement to provide extra info about the context of the assertion. For instance one might want to include values of local or dynamic bindings into the assert report, or use clojure.spec/assert to leverage structured errors with {{specs}} outside of testing environments.

With {{clojure.core/assert}} one can splice extra data into formated message but with {{clojure.spec/assert}} there is no such feature. The {{message}} argument to clojure's {{assert}} was added in CLJ-774, and it was acknowledged there that the mechanism is not ideal. One notable benefit of passing reports as data is that editors can handle those gracefully in case of large data.

This proposal is related to CLJ-415 but has a broader scope. With an extra map one can pass any value (not just locals), and there is no danger of inadvertently flooding the REPL with large locals.

6 Answers

0 votes
by

Comment made by: alexmiller

Can you start this with a use case for what you are trying to do where this would be useful? The title here is a solution but we find it is best to start with a problem, consider alternatives, and choose a solution.

0 votes
by

Comment made by: vitoshka

EDITED: Moved motivation into the issue's "Description".

0 votes
by

Comment made by: alexmiller

Rewriting the ticket from this perspective would be a good start.

0 votes
by

Comment made by: vitoshka

I would be happy to rewrite, but Jira doesn't allow editing the description.

0 votes
by

Comment made by: alexmiller

Sorry about that! I've given you edit rights.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-2223 (reported by vitoshka)
...