anmonteiro/lumo

Improvements to exception messages and printing

Open

#474 aperta il 23 apr 2019

Vedi su GitHub
 (4 commenti) (1 reazione) (0 assegnatari)Clojure (83 fork)batch import
help wanted

Metriche repository

Star
 (1875 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Lumo v1.10.1.

Steps (based on https://dev.clojure.org/jira/browse/CLJS-2913?focusedCommentId=50751):

Execute in Lumo:

(require '[cljs.spec.alpha :as s])
(require '[cljs.spec.test.alpha :as st])

;; instrumenting a function
(s/fdef foobar :args (s/cat :x int?))
(defn foobar [x] x)

(st/instrument)

;; set up an example spec printer
(set! s/*explain-out* (fn [e-data] (println "SPEC ERROR!")))

(foobar "")

Actual:

Call to #'cljs.user/foobar did not conform to spec.

Expected:

Execution error - invalid arguments to user/foobar at (REPL:1).
SPEC ERROR!

See the related Planck issue https://github.com/planck-repl/planck/issues/845 which in turn follows https://dev.clojure.org/jira/browse/CLJS-2913.

Also this https://github.com/bhb/expound issue seems to be related (as the lib is based on setting s/*explain-out*): https://github.com/bhb/expound/issues/152.

Guida contributor