Skip to content

Commit b827d95

Browse files
committed
wrap stacktrace canonicalization to suppress stack parse failures
if :repl-verbose, print failed stacktrace canonicalization
1 parent 51780d7 commit b827d95

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/clj/cljs/repl.clj

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,21 +353,27 @@
353353
(defn- display-error
354354
([repl-env ret form opts]
355355
(display-error repl-env ret form (constantly nil) opts))
356-
([repl-env ret form f opts]
356+
([repl-env ret form f {:keys [print flush]}]
357357
(f)
358358
(when-let [value (:value ret)]
359-
((:print opts) value))
359+
(print value))
360360
(when-let [st (:stacktrace ret)]
361361
(if (and (true? (:source-map opts))
362362
(satisfies? IParseStacktrace repl-env))
363-
(let [cst (-parse-stacktrace repl-env st ret opts)]
363+
(let [cst (try
364+
(-parse-stacktrace repl-env st ret opts)
365+
(catch Throwable e
366+
(when (:repl-verbose opts)
367+
(print "Failed to canonicalize stacktrace")
368+
(print (with-out-str (.printStacktrace e *out*)))
369+
(flush))))]
364370
(if (vector? cst)
365371
(if (satisfies? IPrintStacktrace repl-env)
366372
(-print-stacktrace repl-env cst ret opts)
367373
(print-mapped-stacktrace cst opts))
368-
((:print opts) st)))
369-
((:print opts) st))
370-
((:flush opts)))))
374+
(print st)))
375+
(print st))
376+
(flush))))
371377

372378
(defn evaluate-form
373379
"Evaluate a ClojureScript form in the JavaScript environment. Returns a

0 commit comments

Comments
 (0)