Skip to content
Chouser edited this page Jun 24, 2011 · 3 revisions

Runtime errors in the cljs repl should now be reported a bit like this:

 1. "Error evaluating:" (cljs.core.prn (pr-str 5))
 2.     :as "cljs.core.fn_of_(cljs.core.prn)(cljs.core.fn_of_(cljs.core.pr_str)(5));\n"
 3. sun.org.mozilla.javascript.internal.EcmaError: TypeError:
 4.     sun.org.mozilla.javascript.internal.Undefined@397577f9 is not a function,
 5.     it is sun.org.mozilla.javascript.internal.Undefined. (cljs/core.cljs#1688)
 6.         at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(ScriptRuntime.java:3224)
 7.         at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(ScriptRuntime.java:3214)
 8.         at sun.org.mozilla.javascript.internal.ScriptRuntime.typeError(ScriptRuntime.java:3230)
 9.         at sun.org.mozilla.javascript.internal.ScriptRuntime.typeError2(ScriptRuntime.java:3249)
10.         at sun.org.mozilla.javascript.internal.ScriptRuntime.notFunctionError(ScriptRuntime.java:3304)
11.         at sun.org.mozilla.javascript.internal.ScriptRuntime.notFunctionError(ScriptRuntime.java:3292)
12.         at sun.org.mozilla.javascript.internal.Interpreter.interpretLoop(Interpreter.java:3104)
13.         at script.pr_str_with_opts(cljs/core.cljs:1688)
14.         at script(<cljs repl>)
15.         [...snip...]

Line 1 is the top-level cljs form being evaluated when the exception was thrown, wrapped with a prn call.

Line 2 shows the JavaScript emitted for the top-level form.

Lines 3-5 describe the specific exception. It's frequently an attempt to call undefined as a function. The only thing likely to be of use here is

Original:

"Error evaluating:" (cljs.core.prn (pr-str 5))
    :as "cljs.core.fn_of_(cljs.core.prn)(cljs.core.fn_of_(cljs.core.pr_str)(5));\n"
javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: TypeError:
    sun.org.mozilla.javascript.internal.Undefined@397577f9 is not a function,
    it is sun.org.mozilla.javascript.internal.Undefined. (goog/base.js#2) in goog/base.js at line number 2
        at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:110)
        at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:124)
        at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
        at cljs.compiler$eval1.invoke(compiler.clj:754)
        at cljs.compiler$repl.doInvoke(compiler.clj:848)
        at clojure.lang.RestFn.invoke(RestFn.java:410)
        at user$eval7099.invoke(NO_SOURCE_FILE:10)
        at clojure.lang.Compiler.eval(Compiler.java:6406)
        at clojure.lang.Compiler.eval(Compiler.java:6372)
        at clojure.core$eval.invoke(core.clj:2745)
        at clojure.main$repl$read_eval_print__6018.invoke(main.clj:244)
        at clojure.main$repl$fn__6023.invoke(main.clj:265)
        at clojure.main$repl.doInvoke(main.clj:265)
        at clojure.lang.RestFn.invoke(RestFn.java:421)
        at clojure.main$repl_opt.invoke(main.clj:331)
        at clojure.main$main.doInvoke(main.clj:427)
        at clojure.lang.RestFn.invoke(RestFn.java:397)
        at clojure.lang.Var.invoke(Var.java:397)
        at clojure.lang.AFn.applyToHelper(AFn.java:159)
        at clojure.lang.Var.applyTo(Var.java:518)
        at clojure.main.main(main.java:37)
Clone this wiki locally