lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Just to mention, I was able to bypass this limitation in Lane (2.0.3) by placing the stack trace via registry from error handler to the lua_pcall caller.

Lanes 2.0.3 will be able to provide this API to users:

	[...]|[ nil, err, stack_tbl ]= lane_h:join( [timeout_secs] )

stack_tbl is an array of "<filename>:<line>" strings, describing where the error was thrown. Use table.concat() to format it to your liking (or just ignore it).

The stack_tbl is the new thing. Seems one was not able to get a stack trace of what had happened within a lane, if it errorred. Now, one can.


Asko Kauppi kirjoitti 22.1.2009 kello 21:30:

In regards to the discussion concerning non-string error values, there is a certain detail of Lua that in my opinion would deserve a change.

The 'lua_pcall' function allows an error handler, which can grab the error message and modify it accordingly (normally, to add stack trace). This implies that the error "message" (as it is called in documentation) is a string. Non-string errors cannot be modified to have a stack trace.

Why not allow an error handler return multiple values? What I have in mind is two (error value + stack trace string). Currently, 'lua_pcall' silently eats up any additional return values from the error handler.