From 67cc12f149135d7a5091ce138d3fa96e71da1f69 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Thu, 27 Apr 2017 02:19:36 +1000 Subject: src/ldo: On non-lua originating error, return the js error as a lightuserdata --- src/ldo.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ldo.js b/src/ldo.js index fa59e0b..6b37e14 100644 --- a/src/ldo.js +++ b/src/ldo.js @@ -297,7 +297,11 @@ const luaD_rawrunprotected = function(L, f, ud) { try { f(L, ud); } catch (e) { - if (lj.status === 0) lj.status = -1; + if (lj.status === 0) { + lj.status = -1; + /* error was not thrown via luaD_throw; push error object as light user data */ + lapi.lua_pushlightuserdata(L, e); + } } L.errorJmp = lj.previous; -- cgit v1.2.3-70-g09d2