|
From: | Ronald Lamprecht |
Subject: | Re: [Enigma-devel] crashes on linux gcc exception handling |
Date: | Tue, 26 Sep 2006 00:25:40 +0200 |
User-agent: | Mozilla Thunderbird 1.0.7 (Windows/20050923) |
Hi, Daniel Heck wrote:
So currently there are three types of errors: 1. Lua code internally raises an error. (Dispatch internally with longjmp or c++ exceptions. If not caught by internally with a pcall, is handed to Enigma which converts it to an exception and throws it.) 2. C code raises a lua_error. This is handled exactly like the above. 3. Enigma raises a C++ excepetion.I only want to make sure that errors that could (or should) be handled inside the Lua scripts _can_ be handled inside the Lua scripts. For example, GetNamedObject() should probably continue to return nil if it is called with an unknown object name and not raise an error. Error handling inside the levels should not suffer from the fact that we start to use exceptions more extensively inside the C++ engine.
Agreed. For common uncritical errors that do not leave the engine in an unconsistent state the usage of special return values is preferrable.
Note that this bug is affecting type 3 errors only. I suspect it is potentially possible to use only type 2's. That would solve the problem on Linux and would allow lua scripts to trap errors. The only downside is that a lua program would trap an error that it is incapable of handing. If it fails to rethrow the error in such a case it would be bad. It could either crash, or it could result in the usefull error message being replaced with a less useful one created by lua's internals.
Currently only "enigma.SendMessage()" converts type 3 to type 2. With a proper use of the catch-statement in luaconf.h and perhaps 2 different runtime exceptions, one for fatal and one for uncritical exceptions, Daniel's proposal should be feasible.
Agreed. And I don't think there is any need for immediate action; but error handling inside the level code is something we should definitely keep in mind.
O.k. - let us switch the configure option to enable-cxxlua as default for all OS and keep in mind the possible improvement.
- Ronald
[Prev in Thread] | Current Thread | [Next in Thread] |