changeset 1708:8d257d56dc42

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 04 Jul 2022 14:06:59 -0600
parents ad5647031343
children 6378d261136e
files src/luan/LuanTable.java src/luan/modules/TableLuan.java
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan/LuanTable.java	Mon Jul 04 12:40:59 2022 -0600
+++ b/src/luan/LuanTable.java	Mon Jul 04 14:06:59 2022 -0600
@@ -259,11 +259,7 @@
 
 	public Object removeFromList(int pos) throws LuanException {
 		checkMutable();
-		try {
-			return list().remove(pos-1);
-		} catch(IndexOutOfBoundsException e) {
-			throw new LuanException("index out of bounds - "+e.getMessage());
-		}
+		return list().remove(pos-1);
 	}
 
 	public void rawSort(Comparator<Object> cmp) throws LuanException {
--- a/src/luan/modules/TableLuan.java	Mon Jul 04 12:40:59 2022 -0600
+++ b/src/luan/modules/TableLuan.java	Mon Jul 04 14:06:59 2022 -0600
@@ -39,7 +39,11 @@
 	public static Object remove(LuanTable list,int pos) throws LuanException {
 		if( list.getMetatable() != null )
 			throw new LuanException("can't remove from a table with a metatable");
-		return list.removeFromList(pos);
+		try {
+			return list.removeFromList(pos);
+		} catch(IndexOutOfBoundsException e) {
+			throw new LuanException("index out of bounds - index="+pos+" length="+list.rawLength());
+		}
 	}
 
 	private static interface LessThan {