improvements to exception messages and printing
Port to ClojureScript.
CLJS-2913.patch passes CI
Much of the new source in cljs.repl is a direct copy of the relevant code from clojure.main. Why is it copied into into cljs.repl? That's where much of the other similar code copied from clojure.main already lives.
In general, the revisions amount to ensuring that exceptions have :clojure.error/phase ex-data on them. As in Clojure, many of the existing exceptions are just chained onto a new exception as the cause.
For cljs.analyzer, this is done / ensured in the wrapping-errors macro. Elsewhere in the code cljs.compiler, cljs.closure, etc, a util/compilation-error helper is used to effect the desired chaining.
As in Clojure, this results in a need to revise many tests to look at cause messages instead of the top-level exception messages, and as in Clojure a thrown-with-cause-msg? facility is copied over to ease transitioning to these kinds of tests.
There is a bit of Clojure code that depends on clojure.spec.alpha being loaded. This hard dependency is eliminated in cljs.repl by instead using resolve for now.
There is also some destructuring code that uses newer :<namespace-name>/keys syntax which is avoided to get things to compile with Clojure 1.8.
https://github.com/clojure/clojurescript/commit/5f0fabc65ae7ba201b32cc513a1e5931a80a2bf7 makes CLJS spec reporting behave like CLJ, which is excellent.
However, until CLJS also ports over the error reporting code in CLJ (which will format spec errors using "explain-out"), users cannot use a third-party spec reporter e.g. expound
For comparison, here is what happens in CLJ