François Perrad wrote:

Ok, Lua tests pass, but the behavior has changed.
(The tests were written to check the exception message, not the full back trace) The pushaction allowed to retrieve the backtrace where the exception occurred. The backtrace from the exception handler is alway the same (docall -> main),
so it has no interest in an user point of view.

Previously :
$ ./parrot languages/lua/lua.pbc -e "error 'user_exception'"
lua.pbc: EVAL_1:34: user_exception
stack traceback:
        languages/lua/src/lib/luaaux.
pir:205 in function 'lua_error'
        languages/lua/src/lib/luabasic.pir:336 in function 'error'
        EVAL_1:34 in function '&main_10'
        languages/lua/src/lib/luaaux.pir:916 in function 'docall'
        lua.pir:353 in function 'dostring'
        lua.pir:247 in function 'runargs'
        lua.pir:120 in function 'main'

Now:
$ ./parrot languages/lua/lua.pbc -e "error 'user_exception'"
lua.pbc: _._:0: user_exception
stack traceback:
        languages/lua/src/lib/luaaux.pir:920 in function 'docall'
        lua.pir:353 in function 'dostring'
        lua.pir:247 in function 'runargs'
        lua.pir:120 in function 'main'

Okay. A record of the original location where the exception was thrown is certainly an important feature to add. Wouldn't it be more useful if you could pass it in as an additional option to 'throw', or if the exception object stored the information for you automatically?

We added a 'stacktrace' attribute to the exception object so we could keep this information persistently. But, it's not currently storing anything. The general idea is that it will run the stack trace once when the exception is thrown, and keep the information around (as a string or as a more useful datastructure) for use by the exception handler, or any subsequent rethrows. Will that provide what you need?

Allison

Reply via email to