Skip to content
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

Closed
bhb opened this issue Mar 16, 2018 · 2 comments
Closed

Allow predicate error messages to be functions #74

bhb opened this issue Mar 16, 2018 · 2 comments

Comments

@bhb
Copy link
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
Copy link
Owner Author

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

@bhb
Copy link
Owner Author

bhb commented Jun 8, 2019

Closing because I don't see a lot of demand for this feature.

@bhb bhb closed this as completed Jun 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant