lua-users home
lua-l archive

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


>>>>> "Roberto" == Roberto Ierusalimschy <roberto@inf.puc-rio.br> writes:

 >> But I am working in an environment - embedding Lua into an existing
 >> large and complex program, namely the PostgreSQL backend - which has
 >> its own rules about error handling that simply do not allow this. In
 >> particular, I can't guarantee that closing a database cursor won't
 >> throw an error, and if it does, then I can't allow execution of
 >> arbitrary Lua code until after the subtransaction has been cleaned
 >> up (which requires propagating the error).

 Roberto> I fully agree that finalizers should not throw errors. If
 Roberto> closing a database cursor must throw an error and you can't
 Roberto> allow execution of arbitrary Lua code etc., then probably you
 Roberto> shouldn't close cursors during finalizers.

That's all very well, but that's just one example of a possible error. I
can't even free allocated memory without the (vanishingly rare, but
possible) chance of an error being thrown.

And then the other obvious problem is that I would have to prevent the
(untrusted) Lua code from creating its own finalizers.

 Roberto> As Gé pointed out, propagating a finalizer error is pointless.
 Roberto> You are interrupting code that has nothing to do with the
 Roberto> error, and cannot know how to handle it.

This. DOES. NOT. MATTER. to me. All that matters is that the error MUST
NOT BE IGNORED.

-- 
Andrew.