From 0c62831eea5e651577928ef8b09c947565eaed7d Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 8 Jun 2013 13:21:14 +0200 Subject: [PATCH] lua: Print traceback on startup errors We do some special magic so that we can have tracebacks on errors messages. However, the code for parsing the rc.lua called it without this magic and thus errors didn't have tracebacks. This is bad, because if something goes wrong in e.g. wibox.widget.textbox, you don't really have any clue where this error is coming from. Fix this by adding our "print traceback on error"-magic here, too. Signed-off-by: Uli Schlachter --- luaa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/luaa.c b/luaa.c index e8e56f86..c86a0e8b 100644 --- a/luaa.c +++ b/luaa.c @@ -666,7 +666,10 @@ luaA_loadrc(const char *confpath, bool run) /* Set the conffile right now so it can be used inside the * configuration file. */ conffile = a_strdup(confpath); - if(lua_pcall(globalconf.L, 0, LUA_MULTRET, 0)) + /* Move error handling function before function */ + lua_pushcfunction(globalconf.L, luaA_dofunction_on_error); + lua_insert(globalconf.L, -2); + if(lua_pcall(globalconf.L, 0, LUA_MULTRET, -2)) { const char *err = lua_tostring(globalconf.L, -1); luaA_startup_error(err);