Skip to content

Commit d9018fe

Browse files
committed
manually set *e in Rhino on JS exception
1 parent 0febb0f commit d9018fe

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/clj/cljs/repl/rhino.clj

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,15 @@
7676
:value (eval-result (-eval js repl-env filename linenum))})
7777
(catch Throwable ex
7878
;; manually set *e
79-
;; (ScriptableObject/putProperty scope "cljs.core._STAR_e"
80-
;; (Context/javaToJS ex scope))
81-
{:status :exception
82-
:value (.toString ex)
83-
:stacktrace (stacktrace ex)})))
79+
(let [top-level (-> scope
80+
(ScriptableObject/getProperty "cljs")
81+
(ScriptableObject/getProperty "core"))]
82+
(ScriptableObject/putProperty top-level "_STAR_e"
83+
(Context/javaToJS ex scope))
84+
(util/debug-prn top-level)
85+
{:status :exception
86+
:value (.toString ex)
87+
:stacktrace (stacktrace ex)}))))
8488

8589
(defn load-file
8690
"Load a JavaScript. This is needed to load JavaScript files before the Rhino

0 commit comments

Comments
 (0)