eukreign / python-v8

Apache License 2.0
12 stars 6 forks source link

No way to get stack trace from javascript TypeError or ReferenceError #15

Open eukreign opened 10 years ago

eukreign commented 10 years ago

From russell....@gmail.com on June 03, 2013 20:29:12

Run something like the following:

import PyV8 c = PyV8.JSContext() c.enter() c.eval("function f(){foo = null; foo.bar();};") c.eval("f()")

The resulting exception shows the line of the error, but there appears to be no way to get the full stack trace (like there would be if the code was something like 'throw Error()')

Original issue: http://code.google.com/p/pyv8/issues/detail?id=178

eukreign commented 10 years ago

From flier...@gmail.com on June 13, 2013 23:43:17

It's a design issue, because the build-in Javascript error will be mapping to build-in Python exception

static struct { const char name; PyObject type; } SupportErrors[] = { { "RangeError", ::PyExc_IndexError }, { "ReferenceError", ::PyExc_ReferenceError }, { "SyntaxError", ::PyExc_SyntaxError }, { "TypeError", ::PyExc_TypeError } };

So, after translate the exception, the stack trace will be lost in the current implementation.

I will work on it later, maybe add it to Exception object

Status: Accepted
Labels: OpSys-All