summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-04-27 02:19:36 +1000
committerdaurnimator <quae@daurnimator.com>2017-04-27 02:32:25 +1000
commit67cc12f149135d7a5091ce138d3fa96e71da1f69 (patch)
tree00f4548127e447da27b0d7ccfb263564f974da92 /src
parentb41aad71a6b0d742cb83c16bcf53c0383de8d77e (diff)
downloadfengari-67cc12f149135d7a5091ce138d3fa96e71da1f69.tar.gz
fengari-67cc12f149135d7a5091ce138d3fa96e71da1f69.tar.bz2
fengari-67cc12f149135d7a5091ce138d3fa96e71da1f69.zip
src/ldo: On non-lua originating error, return the js error as a lightuserdata
Diffstat (limited to 'src')
-rw-r--r--src/ldo.js6
1 files changed, 5 insertions, 1 deletions
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;