[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: expanded errors factories
- From: John Belmonte <john@...>
- Date: Sat, 30 Dec 2006 12:31:51 -0500
Mildred wrote:
> I read the text at http://lua-users.org/wiki/FinalizedExceptions and I
> found it very useful ...
>
> The main problem from my point of view is that when you transform
> errors into messages (strings) and back into exceptions, you
> lose the stack traceback.
> So I created a module that instead of transforming transforming
> errors into strings, they are transformed into exceptions objects, that
> contains the stack traceback. (it uses xpcall)
>
> But, if the exception is not catched, the lua interpreter is not able
> to transform the table to a string (the metamethod __tostring is
> defined) so the traceback is not displayed. So I replaced the function
> debug.traceback by a function that do exactly the same but transform
> the error object to a string if it is not.
See also <http://www.lua.org/wshop06.html#Belmonte>. In any case, I
think the Lua authors plan to have lua.c honor __tostring on unhandled
exception objects in a future release.
--John