Handle exceptions in the rest of the Lua API.

Now we can use proper RAII.