comparison src/luan/LuanJavaFunction.java @ 88:6ca02b188dba

add LuanBit to clean up code; add repr(); git-svn-id: https://luan-java.googlecode.com/svn/trunk@89 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Wed, 27 Feb 2013 23:50:32 +0000
parents 6db8f286fa6c
children 9aa7d5f20333
comparison
equal deleted inserted replaced
87:eaf37cfa30c2 88:6ca02b188dba
72 } catch(InvocationTargetException e) { 72 } catch(InvocationTargetException e) {
73 Throwable cause = e.getCause(); 73 Throwable cause = e.getCause();
74 if( cause instanceof Error ) 74 if( cause instanceof Error )
75 throw (Error)cause; 75 throw (Error)cause;
76 if( cause instanceof RuntimeException ) 76 if( cause instanceof RuntimeException )
77 throw new LuanException(luan,LuanElement.JAVA,cause); 77 throw luan.JAVA.exception(cause);
78 if( cause instanceof LuanException ) 78 if( cause instanceof LuanException )
79 throw (LuanException)cause; 79 throw (LuanException)cause;
80 throw new RuntimeException(e); 80 throw new RuntimeException(e);
81 } catch(InstantiationException e) { 81 } catch(InstantiationException e) {
82 throw new RuntimeException(e); 82 throw new RuntimeException(e);
92 Object arg = args[i]; 92 Object arg = args[i];
93 if( !paramType.isInstance(arg) ) { 93 if( !paramType.isInstance(arg) ) {
94 String expected = paramType.getSimpleName(); 94 String expected = paramType.getSimpleName();
95 if( arg==null ) { 95 if( arg==null ) {
96 if( paramType.isPrimitive() ) 96 if( paramType.isPrimitive() )
97 throw new LuanException(luan,LuanElement.JAVA,"bad argument #"+(i+1-start)+" ("+expected+" expected, got nil)"); 97 throw luan.JAVA.exception("bad argument #"+(i+1-start)+" ("+expected+" expected, got nil)");
98 } else { 98 } else {
99 String got = arg.getClass().getSimpleName(); 99 String got = arg.getClass().getSimpleName();
100 throw new LuanException(luan,LuanElement.JAVA,"bad argument #"+(i+1-start)+" ("+expected+" expected, got "+got+")"); 100 throw luan.JAVA.exception("bad argument #"+(i+1-start)+" ("+expected+" expected, got "+got+")");
101 } 101 }
102 } 102 }
103 } 103 }
104 } 104 }
105 105