Mercurial Hosting > luan
diff src/luan/LuaJavaFunction.java @ 40:e3624b7cd603
implement stack trace
git-svn-id: https://luan-java.googlecode.com/svn/trunk@41 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 21 Dec 2012 10:45:54 +0000 |
parents | 8a57ebfdfd78 |
children | 80b67b1a653c |
line wrap: on
line diff
--- a/src/luan/LuaJavaFunction.java Thu Dec 20 02:54:06 2012 +0000 +++ b/src/luan/LuaJavaFunction.java Fri Dec 21 10:45:54 2012 +0000 @@ -40,7 +40,7 @@ return method.getParameterTypes(); } - @Override public Object[] call(LuaState lua,Object... args) { + @Override public Object[] call(LuaState lua,Object[] args) throws LuaException { args = fixArgs(lua,args); Object rtn; try { @@ -48,6 +48,13 @@ } catch(IllegalAccessException e) { throw new RuntimeException(e); } catch(InvocationTargetException e) { + Throwable cause = e.getCause(); + if( cause instanceof Error ) + throw (Error)cause; + if( cause instanceof RuntimeException ) + throw (RuntimeException)cause; + if( cause instanceof LuaException ) + throw (LuaException)cause; throw new RuntimeException(e); } catch(InstantiationException e) { throw new RuntimeException(e);