changeset 592:1c64b1fd882b

handle StackOverflowError
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 31 Aug 2015 08:03:58 -0600
parents 790d5de23042
children 92c9fa5e39e6
files core/src/luan/impl/Closure.java
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
diff -r 790d5de23042 -r 1c64b1fd882b core/src/luan/impl/Closure.java
--- 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 {