New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow predicate error messages to be functions #74

Open
bhb opened this Issue Mar 16, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@bhb
Owner

bhb commented Mar 16, 2018

The second arg to expound/def could either be a string or a function that is passed the problem (and maybe the spec itself?) and returns an error string. I believe that would allow you to grab any information you’ve added to the problem and would also allow you to include any relevant information (e.g. the range information) in the message.

https://clojureverse.org/t/improving-error-messages-in-clojure-as-a-library/1765/14?u=bbrinck

@bhb bhb added the enhancement label Mar 16, 2018

@bhb

This comment has been minimized.

Owner

bhb commented May 12, 2018

Use case: spec-tools allows users to add a "reason" to specs https://github.com/metosin/spec-tools/blob/master/README.md#custom-errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment