[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: how to get stacktrace
- From: Max Ischenko <max@...>
- Date: Fri, 22 Jun 2001 16:07:04 +0300
I use call() to safely run a Lua function.
If an error occurs during the call, I want to dump stacktrace and
continue.
Currently I'm using the following code.
Would anyone mind to help me improve it?
local handler = function(errstr)
local t = getinfo(2) or getinfo(3)
local s = format("Lua error %s at %s%s",
errstr, t.currentline or '?', t.source or '?')
mark_failed(%test, s)
end
local code, msg = call(dispatch_command,
{cmd}, 'x', handler)
--
The best writing is rewriting.
-- E. B. White