diff core/src/luan/impl/Closure.java @ 592:1c64b1fd882b

handle StackOverflowError
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 31 Aug 2015 08:03:58 -0600
parents c6bcb8859b93
children 859c0dedc8b6
line wrap: on
line diff
--- a/core/src/luan/impl/Closure.java	Sun Aug 30 11:37:39 2015 -0600
+++ b/core/src/luan/impl/Closure.java	Mon Aug 31 08:03:58 2015 -0600
@@ -39,7 +39,11 @@
 	}
 
 	@Override public Object call(LuanState luan,Object[] args) throws LuanException {
-		return call(this,(LuanStateImpl)luan,args);
+		try {
+			return call(this,(LuanStateImpl)luan,args);
+		} catch(StackOverflowError e) {
+			throw new LuanException(luan, "stack overflow" );
+		}
 	}
 
 	private static Object call(Closure closure,LuanStateImpl luan,Object[] args) throws LuanException {