From f1274016f284ad3c1d5f9e87db6cbedb86fef18d Mon Sep 17 00:00:00 2001 From: daurnimator Date: Mon, 15 May 2017 19:34:05 +1000 Subject: src/ldo.js: message handler should still be run after native error handling --- src/ldo.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/ldo.js') diff --git a/src/ldo.js b/src/ldo.js index c4619e5..3bbcec6 100644 --- a/src/ldo.js +++ b/src/ldo.js @@ -283,6 +283,16 @@ const luaD_rawrunprotected = function(L, f, ud) { lapi.lua_pushlightuserdata(L, e); luaD_callnoyield(L, L.top - 2, 1); + /* Now run the message handler (if it exists) */ + /* copy of luaG_errormsg without the throw */ + if (L.errfunc !== 0) { /* is there an error handling function? */ + let errfunc = L.errfunc; + L.stack[L.top] = L.stack[L.top - 1]; + L.stack[L.top - 1] = L.stack[errfunc]; + L.top++; + luaD_callnoyield(L, L.top - 2, 1); + } + lj.status = TS.LUA_ERRRUN; } catch(e2) { if (lj.status === TS.LUA_OK) { -- cgit v1.2.3-54-g00ecf