Skip to content

Commit 424af2a

Browse files
John Michael Newman IIIswannodette
authored andcommitted
CLJS-2653: REPL crash when mapping stacktrace in Chrome for js/blah
Added logic in cljs/repl.cljc/file-display to differentiate directories coming from ./out/* vs coming from cli files
1 parent ee68db2 commit 424af2a

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/main/clojure/cljs/repl.cljc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@
336336
{:function name'
337337
:call call
338338
:file (if no-source-file?
339-
(str "NO_SOURCE_FILE"
339+
(str "<NO_SOURCE_FILE>"
340340
(when file
341341
(str " " file)))
342342
(io/file file'))
@@ -378,8 +378,12 @@
378378
(defn file-display
379379
[file {:keys [output-dir temp-output-dir?]}]
380380
(if temp-output-dir?
381-
(let [canonicalize (fn [file] (.getCanonicalPath (io/file file)))]
382-
(subs (canonicalize file) (inc (count (canonicalize output-dir)))))
381+
(let [canonicalize (fn [file] (.getCanonicalPath (io/file file)))
382+
can-file (canonicalize file)
383+
can-out (canonicalize output-dir)]
384+
(if (.startsWith can-file can-out)
385+
(subs can-file (inc (count can-out)))
386+
(subs can-file (inc (.lastIndexOf can-file java.io.File/separator)))))
383387
file))
384388

385389
(defn print-mapped-stacktrace
@@ -843,7 +847,7 @@
843847
caught repl-caught
844848
reader #(readers/source-logging-push-back-reader
845849
*in*
846-
1 "NO_SOURCE_FILE")
850+
1 "<NO_SOURCE_FILE>")
847851
print-no-newline print
848852
source-map-inline true
849853
repl-requires '[[cljs.repl :refer-macros [source doc find-doc apropos dir pst]]

0 commit comments

Comments
 (0)