-
Notifications
You must be signed in to change notification settings - Fork 790
REPL stack traces
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 the file anme and approximate line number, both of which are repeated on line 13.
Lines 6-12 can be safely ignore, I believe.
Line 13 is the first .cljs
file mentioned in the stack trace. The filename
should be correct but the line number is approximate -- usually it is too large,
so start on that line number and look earlier in the file for the actual line
causing the problem. If you're fortunate you'll see an (unqualified by any
namespace), munged, cljs function name, pr_str_with_opts
in this example. The
function name, if it appears, is more likely to be accurate than the line
number.
Line 14 represents the expression entered at the repl, details of which were printed on lines 1 and 2 of the error report.
- Rationale
- Quick Start
- Differences from Clojure
- [Usage of Google Closure](Google Closure)