-
Notifications
You must be signed in to change notification settings - Fork 24
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
When expound can't print error (due to conformers), print vanilla spec error #78
Comments
Related: #102 |
Workaround: (require '[expound.alpha :as expound])
(defn safe-printer [explain-data]
(let [exp (expound/custom-printer {})]
(try
(exp explain-data)
(catch Exception e e
(s/explain-printer explain-data)))))
(set! s/*explain-out* safe-printer)
(s/def ::sorted-pair (s/and (s/cat :x int? :y int?) #(< (-> % :x) (-> % :y))))
;; Usually use expound
(s/explain int? "a")
;;-- Spec failed --------------------
;;
;; "a"
;;
;;should satisfy
;;
;; int?
;;
;;-------------------------
;;Detected 1 error
;; If there is an issue, fallback on s/explain-printer
(s/explain ::sorted-pair [0 0])
;; val: {:x 0, :y 0} fails spec: :expound.alpha/sorted-pair predicate: (< (-> % :x) (-> % :y)) |
I have run into this and thanks for the workaround! |
@arichiardi @borkdude I've got a fix for this issue in 0.7.2-SNAPSHOT. If you have time to try it out, please let me know what you think! |
First feedback, with
|
Good catch! I've added a new check for warnings to the CI script and fixed this warning. I've pushed a new version of |
@bhb Is this also available in master? I've tried http://bit.ly/speculative-repl with
and I'm seeing:
|
This is currently only on the “next” branch. I’m hoping to get a release out this month, which will move this to master. |
Fixed in 0.7.2-SNAPSHOT (to be released soon) |
No description provided.
The text was updated successfully, but these errors were encountered: