[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] patch-lua-5.1.4-3
- From: Daurnimator <quae@...>
- Date: Sat, 19 Mar 2011 10:42:48 +1100
On 19 March 2011 04:16, Roberto Ierusalimschy <email@example.com> wrote:
>> xpcall does not handle ERRERR how it should.
>> The error handler for the error handler is itself; not the upper scope
>> as you would imagine.
> You may argue that this is poor design, but it is not a bug.
> Even the design is disputable. If you consider that an error in the
> error function should be handled in an upper scope, it would be more
> coherent that the current call to 'xpcall' did not return, but instead
> long-jumped to the upper xpcall. The current design ensures that xpcall
> always returns (that is, it never raises an error), no matter what.
> -- Roberto
I still think an error in an error handling function would be expected
to error... To do what you describe, I would imagine I'd put a pcall
in the error function:
-- Protected xpcall
pxpcall = function(func,errfunc,...) return xpcall( func,function(e)
pcall(errfunc,e) return true end ) end
In any case, this "bug" has stopped me from writing sensible error
handling multiple times.