From e5a9eef1574a24074f7e05ead887b29ae2251be4 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 8 Aug 2015 13:09:25 +0200 Subject: [PATCH] Widget drawing: Add a traceback on errors Signed-off-by: Uli Schlachter --- lib/wibox/layout/base.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/wibox/layout/base.lua b/lib/wibox/layout/base.lua index 97e939661..3842a6b67 100644 --- a/lib/wibox/layout/base.lua +++ b/lib/wibox/layout/base.lua @@ -6,7 +6,7 @@ --------------------------------------------------------------------------- local pairs = pairs -local pcall = pcall +local xpcall = xpcall local print = print local min = math.min local max = math.max @@ -67,10 +67,11 @@ function base.draw_widget(wibox, cr, widget, x, y, width, height) cr:clip() -- Let the widget draw itself - local success, msg = pcall(widget.draw, widget, wibox, cr, width, height) - if not success then - print("Error while drawing widget: " .. msg) - end + xpcall(function() + widget:draw(wibox, cr, width, height) + end, function(err) + print(debug.traceback("Error while drawing widget: "..tostring(err), 2)) + end) -- Register the widget for input handling wibox:widget_at(widget, base.rect_to_device_geometry(cr, 0, 0, width, height))