Description
This task will fix #99.
The idea is to protect all calls into Lua from C using pcall. If there is an error, it will be handled by the current global error handlers. If there is no current error handler then we'll throw an unprotected lua error (most likely this will crash the process).
Since calls to uv.run()
are blocking, then "nested" calls will be all "stacked" in the current C stack. Therefore users can have nested error handlers. A unit test framework may wish to handle all global errors, but only for the duration of it's test unit. It can call and block on uv.run()
with a custom error handlers that pertains to that one test. When the test finishes and uv.run()
returns, then the old error handler will be restored.
The new signature will be uv.run(mode, onError)
.