changeset 2004:2936d52d9d5b default tip

error(message,e)
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 27 Jul 2025 16:23:36 -0600
parents f777348734b6
children
files src/luan/modules/BasicLuan.java src/luan/modules/Boot.luan
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan/modules/BasicLuan.java	Thu Jul 24 22:04:08 2025 -0600
+++ b/src/luan/modules/BasicLuan.java	Sun Jul 27 16:23:36 2025 -0600
@@ -132,9 +132,15 @@
 		return luan.luanToString(v);
 	}
 
-	public static LuanTable new_error(Luan luan,Object msg) throws LuanException {
+	public static LuanTable new_error(Luan luan,Object msg,LuanTable le) throws LuanException {
 		String s = luan.luanToString(msg);
-		LuanTable tbl = new LuanException(s).table(luan);
+		LuanTable tbl;
+		if( le == null ) {
+			tbl = new LuanException(s).table(luan);
+		} else {
+			LuanException e = (LuanException)le.rawGet("java");
+			tbl = new LuanException(s,e).table(luan);
+		}
 		tbl.rawPut( "message", msg );
 		return tbl;
 	}
--- a/src/luan/modules/Boot.luan	Thu Jul 24 22:04:08 2025 -0600
+++ b/src/luan/modules/Boot.luan	Sun Jul 27 16:23:36 2025 -0600
@@ -23,8 +23,8 @@
 local Boot = {}
 
 
-local function error(message)
-	new_error(message).throw()
+local function error(message,e)
+	new_error(message,e).throw()
 end
 Boot.error = error