This repository has been archived by the owner on Jun 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 85
Improvements to exception messages and printing #474
Labels
Comments
I tried to find some temporary workaround. But so far the only thing I came up with is redefining printing of (require '[clojure.spec.alpha :as s]
'[cljs.spec.test.alpha :as st]
'[cljs.repl :as repl])
(extend-type ExceptionInfo
IPrintWithWriter
(-pr-writer
[o writer _opts]
(-write writer (repl/error->str o)))) And then after spec fails one can evaluate (s/fdef foobar :args (s/cat :x int?))
(defn foobar [x] x)
(st/instrument)
This will not help in case the script is executed from file. |
A better workaround is to patch ; test.cljs
(ns my.test
(:require [clojure.spec.alpha :as s]
[cljs.spec.test.alpha :as st]
[cljs.repl :as repl]
[lumo.repl :as lumo-repl]))
; HACK: workaround for https://github.com/anmonteiro/lumo/issues/474
(set! lumo-repl/handle-error
(fn custom-handle-error
[error stacktrace?]
(#'lumo-repl/print-error error stacktrace?)
(print (repl/error->str error))
(if-not (:repl? @#'lumo-repl/app-opts)
(set! (. js/process lumo-repl/-exitCode) 1)
(set! *e (#'lumo-repl/extract-cljs-js-error error)))))
(s/fdef foobar :args (s/cat :x int?))
(defn foobar [x] x)
(st/instrument)
(foobar "")
|
@anmonteiro |
@vincent-dm I don't know what the problem is, and don't have too much time to investigate. The |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Lumo v1.10.1.
Steps (based on https://dev.clojure.org/jira/browse/CLJS-2913?focusedCommentId=50751):
Execute in Lumo:
Actual:
Expected:
See the related Planck issue planck-repl/planck#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*
): bhb/expound#152.The text was updated successfully, but these errors were encountered: