API: emit nvim_error_event on failed async request

We already do this for _invalid_ async requests #9300.
Now we also do it for failed invocation of valid requests.
This commit is contained in:
Justin M. Keyes
2019-04-13 02:13:29 +02:00
parent d08692a824
commit 7e1591e06a
6 changed files with 73 additions and 14 deletions

View File

@@ -627,6 +627,19 @@ local function table_flatten(arr)
return result
end
-- Checks if a list-like (vector) table contains `value`.
local function table_contains(t, value)
if type(t) ~= 'table' then
error('t must be a table')
end
for _,v in ipairs(t) do
if v == value then
return true
end
end
return false
end
local function hexdump(str)
local len = string.len(str)
local dump = ""
@@ -771,6 +784,7 @@ local module = {
repeated_read_cmd = repeated_read_cmd,
shallowcopy = shallowcopy,
sleep = sleep,
table_contains = table_contains,
table_flatten = table_flatten,
tmpname = tmpname,
uname = uname,