Widget drawing: Add a traceback on errors
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
d122b825ee
commit
e5a9eef157
|
@ -6,7 +6,7 @@
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local pcall = pcall
|
local xpcall = xpcall
|
||||||
local print = print
|
local print = print
|
||||||
local min = math.min
|
local min = math.min
|
||||||
local max = math.max
|
local max = math.max
|
||||||
|
@ -67,10 +67,11 @@ function base.draw_widget(wibox, cr, widget, x, y, width, height)
|
||||||
cr:clip()
|
cr:clip()
|
||||||
|
|
||||||
-- Let the widget draw itself
|
-- Let the widget draw itself
|
||||||
local success, msg = pcall(widget.draw, widget, wibox, cr, width, height)
|
xpcall(function()
|
||||||
if not success then
|
widget:draw(wibox, cr, width, height)
|
||||||
print("Error while drawing widget: " .. msg)
|
end, function(err)
|
||||||
end
|
print(debug.traceback("Error while drawing widget: "..tostring(err), 2))
|
||||||
|
end)
|
||||||
|
|
||||||
-- Register the widget for input handling
|
-- Register the widget for input handling
|
||||||
wibox:widget_at(widget, base.rect_to_device_geometry(cr, 0, 0, width, height))
|
wibox:widget_at(widget, base.rect_to_device_geometry(cr, 0, 0, width, height))
|
||||||
|
|
Loading…
Reference in New Issue