aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-04-19 17:47:35 +1000
committerdaurnimator <quae@daurnimator.com>2017-04-19 18:09:16 +1000
commitd33794a4181964a729fc3e8c6eb1b7119a6d52d6 (patch)
treeb268df15456a1f0ee71932f1222ea0bd5dd585bc
parent4105fee42aa927c4da8ddd7b2e51b9f55202ddeb (diff)
downloadfengari-d33794a4181964a729fc3e8c6eb1b7119a6d52d6.tar.gz
fengari-d33794a4181964a729fc3e8c6eb1b7119a6d52d6.tar.bz2
fengari-d33794a4181964a729fc3e8c6eb1b7119a6d52d6.zip
lauxlib: Fix error handling in luaL_loadfilex
-rw-r--r--src/lauxlib.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index 311e2eb..3bf5b86 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -513,7 +513,7 @@ if (typeof require === "function") {
const errfile = function(L, what, fnameindex, error) {
let serr = error.message;
let filename = lapi.lua_tostring(L, fnameindex).slice(1);
- lapi.lua_pushstring(L, lua.to_luastring(`cannot ${lobject.jsstring(what)} ${lobject.jsstring(filename)}: ${lobject.jsstring(serr)}`));
+ lapi.lua_pushstring(L, lua.to_luastring(`cannot ${what} ${lobject.jsstring(filename)}: ${serr}`));
lapi.lua_remove(L, fnameindex);
return lua.thread_status.LUA_ERRFILE;
};
@@ -578,7 +578,7 @@ if (typeof require === "function") {
try {
lf.f = fs.openSync(jsfilename, "r");
} catch (e) {
- return errfile(L, lua.to_luastring("open"), fnameindex, e);
+ return errfile(L, "open", fnameindex, e);
}
}
@@ -597,7 +597,7 @@ if (typeof require === "function") {
return status;
} catch (err) {
lapi.lua_settop(L, fnameindex); /* ignore results from 'lua_load' */
- return errfile(L, lua.to_luastring("read"), fnameindex);
+ return errfile(L, "read", fnameindex, err);
}
};