lua-users home
lua-l archive

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


Hi,

On Thu, Mar 25, 2010 at 1:56 PM, Jon Nalley <lists@bluebot.org> wrote:
If I prevent socket.protect() from being overridden by copas the error
is returned as expected.  I am not sure if copcall() is making
assumptions about the exceptions that it may catch or if it is
actually encapsulating the error message in a table.  I am continuing

As I recall, socket.try() encapsulates the emsg in a table before
throwing it, and socket.protect() checks if the error is a table. If
it is, it assumes it was raised by try(), unwraps it, and returns
nil,emsg. Otherwise it just reraises it.

Could it be that copas's definition of socket.protect is not quite right?

The reason try() encapsulates the message is so protect()
can distinguish between normal error messages and the
messages generated by try(). Protect() will let the normal
error messages through. It is somewhat of a hack, but works
reasonably well until Lua starts raising error messages that
are not strings. :/

Regards,
Diego