Mercurial Hosting > luan
diff core/src/luan/LuanState.java @ 578:60c549d43988
remove LuanState.exception()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 14 Jul 2015 17:40:48 -0600 |
parents | 4723d22062ce |
children | f22a09e98b04 |
line wrap: on
line diff
--- a/core/src/luan/LuanState.java Mon Jul 13 20:53:02 2015 -0600 +++ b/core/src/luan/LuanState.java Tue Jul 14 17:40:48 2015 -0600 @@ -65,15 +65,10 @@ } - - public LuanException exception(Object msg) throws LuanException { - return new LuanException(this,msg); - } - public Boolean checkBoolean(Object obj) throws LuanException { if( obj instanceof Boolean ) return (Boolean)obj; - throw exception( "attempt to use '"+context()+"' (a " + Luan.type(obj) + " value) as a boolean" ); + throw new LuanException(this, "attempt to use '"+context()+"' (a " + Luan.type(obj) + " value) as a boolean" ); } public Boolean checkBoolean(Object obj,LuanElement el) throws LuanException { @@ -88,13 +83,13 @@ public String checkString(Object obj) throws LuanException { if( obj instanceof String ) return (String)obj; - throw exception( "attempt to use '"+context()+"' (a " + Luan.type(obj) + " value) as a string" ); + throw new LuanException(this, "attempt to use '"+context()+"' (a " + Luan.type(obj) + " value) as a string" ); } public LuanFunction checkFunction(Object obj) throws LuanException { if( obj instanceof LuanFunction ) return (LuanFunction)obj; - throw exception( "attempt to call '"+context()+"' (a " + Luan.type(obj) + " value)" ); + throw new LuanException(this, "attempt to call '"+context()+"' (a " + Luan.type(obj) + " value)" ); } public boolean isLessThan(Object o1,Object o2) throws LuanException { @@ -111,7 +106,7 @@ LuanFunction fn = getBinHandler("__lt",o1,o2); if( fn != null ) return checkBoolean( Luan.first(fn.call(this,new Object[]{o1,o2})) ); - throw exception( "attempt to compare " + Luan.type(o1) + " with " + Luan.type(o2) ); + throw new LuanException(this, "attempt to compare " + Luan.type(o1) + " with " + Luan.type(o2) ); } public String toString(Object obj) throws LuanException { @@ -144,7 +139,7 @@ } if( obj != null && hasJava() ) return JavaLuan.__index(this,obj,key,false); - throw exception( "attempt to index a " + Luan.type(obj) + " value in '"+context()+"'" ); + throw new LuanException(this, "attempt to index a " + Luan.type(obj) + " value in '"+context()+"'" ); } public String context() { @@ -183,7 +178,7 @@ public Number checkNumber(Object obj) throws LuanException { if( obj instanceof Number ) return (Number)obj; - throw exception( "attempt to perform arithmetic on '"+context()+"' (a " + Luan.type(obj) + " value)" ); + throw new LuanException(this, "attempt to perform arithmetic on '"+context()+"' (a " + Luan.type(obj) + " value)" ); } */ }