anmonteiro/lumo

Improvements to exception messages and printing

Open

#474 ouverte le 23 avr. 2019

Voir sur GitHub
 (4 commentaires) (1 réaction) (0 assignés)Clojure (83 forks)batch import
help wanted

Métriques du dépôt

Stars
 (1 875 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

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.

Guide contributeur