Closed GoogleCodeExporter closed 9 years ago
Hmm, I'm not sure why it is missing to be honest. Care to submit a patch or
paste
your changes here and ill merge back in?
Original comment by capre...@gmail.com
on 21 May 2009 at 5:07
Sorry, just checked my code, it is not in ThrowExceptionFromError() but in
ObjectTranslator.throwError(). The old code is still there. The thing I added
is to
also provide chunck name and line number for Exceptions raised from .NET side.
It's like this:
internal void throwError(IntPtr luaState,object e)
{
// If the argument is a mere string, we are free to add extra info to it
(as opposed to some private C# exception object or somesuch, which we just pass
up)
// We use this to remove anything pushed by luaL_where
int oldTop = LuaDLL.lua_gettop(luaState);
// Stack frame #1 is our C# wrapper, so not very interesting to the user
// Stack frame #2 must be the lua code that called us, so that's what we
want to use
LuaDLL.luaL_where(luaState, 1);
object[] curlev = popValues(luaState, oldTop);
// Debug.WriteLine(curlev);
string errLocation = "";
if (curlev.Length > 0)
errLocation = curlev[0].ToString();
if (e is string)
e = errLocation + e;
else if (e is Exception)
{
Exception ex = e as Exception;
Exception luaex = new ApplicationException(errLocation + ex.Message, ex);
e = luaex;
}
push(luaState,e);
LuaDLL.lua_error(luaState);
}
Here the use of ApplicationException should be a bad idea. I just wrote it to
make a
quick working build.
Original comment by qrl...@gmail.com
on 21 May 2009 at 11:58
Fixed in r14, please verify
Original comment by capre...@gmail.com
on 16 Sep 2009 at 4:31
Original issue reported on code.google.com by
qingrui...@gmail.com
on 6 May 2009 at 9:24