anmonteiro/lumo

Improvements to exception messages and printing

Open

#474 opened on Apr 23, 2019

View on GitHub
 (4 comments) (1 reaction) (0 assignees)Clojure (83 forks)batch import
help wanted

Repository metrics

Stars
 (1,875 stars)
PR merge metrics
 (No merged PRs in 30d)

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.

Contributor guide