summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ldo.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ldo.js b/src/ldo.js
index c762798..004c659 100644
--- a/src/ldo.js
+++ b/src/ldo.js
@@ -297,10 +297,14 @@ const luaD_rawrunprotected = function(L, f, ud) {
try {
f(L, ud);
} catch (e) {
- if (lj.status === 0) {
+ if (lj.status === TS.LUA_OK) {
+ /* error was not thrown via luaD_throw, i.e. it is a JS error */
lj.status = -1;
- /* error was not thrown via luaD_throw; push error object as light user data */
- lapi.lua_pushlightuserdata(L, e);
+ /* run error handler (if possible) with error object as light userdata */
+ try {
+ lapi.lua_pushlightuserdata(L, e);
+ ldebug.luaG_errormsg(L);
+ } catch (e) {}
}
}