diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-04 12:32:39 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-04 12:32:55 +1000 |
commit | e78c26fbbd69e09f5271371eccc99f967de7540a (patch) | |
tree | 7f99b9d5572e883c84c50c4f14cd6ea8dec918b3 /src/ldo.js | |
parent | 097d9a2834b7dbceb44b24f3ff73d798b98900f7 (diff) | |
download | fengari-e78c26fbbd69e09f5271371eccc99f967de7540a.tar.gz fengari-e78c26fbbd69e09f5271371eccc99f967de7540a.tar.bz2 fengari-e78c26fbbd69e09f5271371eccc99f967de7540a.zip |
src/ldo.js: Throw JS errors as runtime errors
Diffstat (limited to 'src/ldo.js')
-rw-r--r-- | src/ldo.js | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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) {} } } |