Mercurial Hosting > luan
diff core/src/luan/modules/BasicLuan.java @ 578:60c549d43988
remove LuanState.exception()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 14 Jul 2015 17:40:48 -0600 |
parents | 7c3ad6db8ac3 |
children | 0742ac78fa69 |
line wrap: on
line diff
--- a/core/src/luan/modules/BasicLuan.java Mon Jul 13 20:53:02 2015 -0600 +++ b/core/src/luan/modules/BasicLuan.java Tue Jul 14 17:40:48 2015 -0600 @@ -39,7 +39,7 @@ fileName = "stdin:"; String src = PackageLuan.read(luan,fileName,addExtension); if( src == null ) - throw luan.exception( "file '"+fileName+"' not found" ); + throw new LuanException(luan, "file '"+fileName+"' not found" ); return load(luan,src,fileName,null,false); } @@ -76,7 +76,7 @@ public static void set_metatable(LuanState luan,LuanTable table,LuanTable metatable) throws LuanException { Utils.checkNotNull(luan,table); if( table.getHandler("__metatable") != null ) - throw luan.exception("cannot change a protected metatable"); + throw new LuanException(luan,"cannot change a protected metatable"); table.setMetatable(metatable); } @@ -101,7 +101,7 @@ LuanTable t = (LuanTable)v; return t.rawLength(); } - throw luan.exception( "bad argument #1 to 'raw_len' (table or string expected)" ); + throw new LuanException(luan, "bad argument #1 to 'raw_len' (table or string expected)" ); } public static String to_string(LuanState luan,Object v) throws LuanException { @@ -109,7 +109,7 @@ } public static LuanTable new_error(LuanState luan,Object msg) throws LuanException { - return luan.exception(msg).table(); + return new LuanException(luan,msg).table(); } public static String assert_string(LuanState luan,String v) throws LuanException { @@ -151,7 +151,7 @@ public static LuanFunction range(LuanState luan,final double from,final double to,Double stepV) throws LuanException { final double step = stepV==null ? 1.0 : stepV; if( step == 0.0 ) - throw luan.exception("bad argument #3 (step may not be zero)"); + throw new LuanException(luan,"bad argument #3 (step may not be zero)"); return new LuanFunction() { double v = from; @@ -185,22 +185,22 @@ Utils.checkNotNull(luan,blocks); Object obj = blocks.get(luan,1); if( obj == null ) - throw luan.exception("missing 'try' value"); + throw new LuanException(luan,"missing 'try' value"); if( !(obj instanceof LuanFunction) ) - throw luan.exception("bad 'try' value (function expected, got "+Luan.type(obj)+")"); + throw new LuanException(luan,"bad 'try' value (function expected, got "+Luan.type(obj)+")"); LuanFunction tryFn = (LuanFunction)obj; LuanFunction catchFn = null; obj = blocks.get(luan,"catch"); if( obj != null ) { if( !(obj instanceof LuanFunction) ) - throw luan.exception("bad 'catch' value (function expected, got "+Luan.type(obj)+")"); + throw new LuanException(luan,"bad 'catch' value (function expected, got "+Luan.type(obj)+")"); catchFn = (LuanFunction)obj; } LuanFunction finallyFn = null; obj = blocks.get(luan,"finally"); if( obj != null ) { if( !(obj instanceof LuanFunction) ) - throw luan.exception("bad 'finally' value (function expected, got "+Luan.type(obj)+")"); + throw new LuanException(luan,"bad 'finally' value (function expected, got "+Luan.type(obj)+")"); finallyFn = (LuanFunction)obj; } try {