diff core/src/luan/modules/IoLuan.java @ 578:60c549d43988

remove LuanState.exception()
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 14 Jul 2015 17:40:48 -0600
parents 7c3ad6db8ac3
children f050c30952c0
line wrap: on
line diff
--- a/core/src/luan/modules/IoLuan.java	Mon Jul 13 20:53:02 2015 -0600
+++ b/core/src/luan/modules/IoLuan.java	Tue Jul 14 17:40:48 2015 -0600
@@ -122,7 +122,7 @@
 				try {
 					if( args.length > 0 ) {
 						if( args.length > 1 || !"close".equals(args[0]) )
-							throw luan.exception( "the only argument allowed is 'close'" );
+							throw new LuanException(luan, "the only argument allowed is 'close'" );
 						in.close();
 						return null;
 					}
@@ -131,7 +131,7 @@
 						in.close();
 					return rtn;
 				} catch(IOException e) {
-					throw luan.exception(e);
+					throw new LuanException(luan,e);
 				}
 			}
 		};
@@ -145,7 +145,7 @@
 				try {
 					if( args.length > 0 ) {
 						if( args.length > 1 || !"close".equals(args[0]) )
-							throw luan.exception( "the only argument allowed is 'close'" );
+							throw new LuanException(luan, "the only argument allowed is 'close'" );
 						in.close();
 						return null;
 					}
@@ -155,7 +155,7 @@
 					}
 					return a;
 				} catch(IOException e) {
-					throw luan.exception(e);
+					throw new LuanException(luan,e);
 				}
 			}
 		};
@@ -272,7 +272,7 @@
 				out.close();
 				return;
 			}
-			throw luan.exception( "bad argument #1 to 'write' (string or binary expected)" );
+			throw new LuanException(luan, "bad argument #1 to 'write' (string or binary expected)" );
 		}
 
 		public LuanTable text_writer() throws IOException {
@@ -585,13 +585,13 @@
 	public static LuanTable uri(LuanState luan,String name,Boolean addExtension) throws LuanException {
 		int i = name.indexOf(':');
 		if( i == -1 )
-			throw luan.exception( "invalid Io.uri name '"+name+"', missing scheme" );
+			throw new LuanException(luan, "invalid Io.uri name '"+name+"', missing scheme" );
 		String scheme = name.substring(0,i);
 		String location = name.substring(i+1);
 		LuanTable schemes = schemes(luan);
 		LuanFunction opener = (LuanFunction)schemes.get(luan,scheme);
 		if( opener == null )
-			throw luan.exception( "invalid scheme '"+scheme+"' in '"+name+"'" );
+			throw new LuanException(luan, "invalid scheme '"+scheme+"' in '"+name+"'" );
 		return (LuanTable)Luan.first(opener.call(luan,new Object[]{location,addExtension}));
 	}
 
@@ -649,7 +649,7 @@
 	public static LuanTable socket(LuanState luan,String name) throws LuanException, IOException {
 		int i = name.indexOf(':');
 		if( i == -1 )
-			throw luan.exception( "invalid socket '"+name+"', format is: <host>:<port>" );
+			throw new LuanException(luan, "invalid socket '"+name+"', format is: <host>:<port>" );
 		String host = name.substring(0,i);
 		String portStr = name.substring(i+1);
 		int port = Integer.parseInt(portStr);
@@ -663,13 +663,13 @@
 				try {
 					if( args.length > 0 ) {
 						if( args.length > 1 || !"close".equals(args[0]) )
-							throw luan.exception( "the only argument allowed is 'close'" );
+							throw new LuanException(luan, "the only argument allowed is 'close'" );
 						ss.close();
 						return null;
 					}
 					return new LuanSocket(ss.accept()).table();
 				} catch(IOException e) {
-					throw luan.exception(e);
+					throw new LuanException(luan,e);
 				}
 			}
 		};