Mercurial Hosting > luan
changeset 210:e84655b4c45e
better exception handling
git-svn-id: https://luan-java.googlecode.com/svn/trunk@211 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 08 Jul 2014 19:05:27 +0000 |
parents | 239c8d650028 |
children | 284eddd599b1 |
files | core/src/luan/LuanJavaFunction.java dist/luan-core-trunk.jar dist/luan-logging-trunk.jar dist/luan-web-trunk.jar |
diffstat | 4 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
diff -r 239c8d650028 -r e84655b4c45e core/src/luan/LuanJavaFunction.java --- a/core/src/luan/LuanJavaFunction.java Tue Jul 08 10:25:35 2014 +0000 +++ b/core/src/luan/LuanJavaFunction.java Tue Jul 08 19:05:27 2014 +0000 @@ -71,8 +71,8 @@ } @Override public Object call(LuanState luan,Object[] args) throws LuanException { - args = fixArgs(luan,args); try { + args = fixArgs(luan,args); return doCall(luan,args); } catch(IllegalArgumentException e) { checkArgs(luan,args); @@ -128,6 +128,8 @@ Object arg = args[i]; if( !type.isInstance(arg) ) { String expected = paramType.getSimpleName(); + if( i==a.length-1 && method.isVarArgs() ) + expected = paramType.getComponentType().getSimpleName()+"..."; if( arg==null ) { if( paramType.isPrimitive() ) throw luan.exception("bad argument #"+(i+1-start)+" ("+expected+" expected, got nil)");
diff -r 239c8d650028 -r e84655b4c45e dist/luan-core-trunk.jar Binary file dist/luan-core-trunk.jar has changed