mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
screen.lua: dump payload on handler failure
For debugging failures like:
test/functional/helpers.lua:240: test/functional/ui/screen.lua:898:
bad argument #1 to 'unpack' (table expected, got number)
test/functional/helpers.lua:240: test/functional/ui/screen.lua:708:
attempt to index local 'item' (a number value)
ref #10804
This commit is contained in:
@@ -615,7 +615,12 @@ function Screen:_redraw(updates)
|
||||
local handler_name = '_handle_'..method
|
||||
local handler = self[handler_name]
|
||||
if handler ~= nil then
|
||||
handler(self, unpack(update[i]))
|
||||
local status, res = pcall(handler, self, unpack(update[i]))
|
||||
if not status then
|
||||
error(handler_name..' failed'
|
||||
..'\n payload: '..inspect(update)
|
||||
..'\n error: '..tostring(res))
|
||||
end
|
||||
else
|
||||
assert(self._on_event,
|
||||
"Add Screen:"..handler_name.." or call Screen:set_on_event_handler")
|
||||
|
||||
Reference in New Issue
Block a user