Merge pull request #384 from blueyed/more-robust-errors

More robust errors: make sure errors are strings

Closes https://github.com/awesomeWM/awesome/pull/384.
This commit is contained in:
Daniel Hahler 2015-09-23 20:59:32 +02:00
commit 4e22cf02e6
2 changed files with 6 additions and 2 deletions

View File

@ -69,8 +69,8 @@ function textbox:set_markup(text)
end
local attr, parsed = Pango.parse_markup(text, -1, 0)
-- In case of error, attr is false and parsed is an error message
if not attr then error(parsed) end
-- In case of error, attr is false and parsed is a GLib.Error instance.
if not attr then error(parsed.message or tostring(parsed)) end
self._markup = text
self._layout.text = parsed

4
luaa.c
View File

@ -323,6 +323,10 @@ luaA_panic(lua_State *L)
static int
luaA_dofunction_on_error(lua_State *L)
{
#if LUA_VERSION_NUM >= 502
/* Convert error to string, to prevent a follow-up error with lua_concat. */
luaL_tolstring(L, -1, NULL);
#endif
/* duplicate string error */
lua_pushvalue(L, -1);
/* emit error signal */