Improvements to exception messages and printing #474
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 |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

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: