[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Error handling
- From: Romulo Bahiense <romulo@...>
- Date: Thu, 16 Feb 2006 22:58:21 -0300
Er, I meant they don't provide a stack trace or anything.
Well, kind of. If your error handler honors __tostring metamethod ...
errtablemt = {
__tostring = function(t)
return string.format(
'An error ocurred with error code %d: %s.\n%s',
t.code,
t.msg,
debug.traceback()
)
end
}
function raise(errtable)
error(setmetatable(errtable, errtablemt))
end
---
function disfunctional()
raise{code=123, msg='bla bla bla'}
end
print(pcall(disfunctional))
I don't know if this is what you meant, though.
--rb