API: return non-generic VimL errors

- Return VimL errors instead of generic errors for:
  - nvim_call_function
  - nvim_call_dict_function
- Fix tests which were silently broken before this change.

This violates #6150 where we agreed not to translate API errors.  But
that can be fixed later.
This commit is contained in:
Justin M. Keyes
2018-05-07 03:24:01 +02:00
parent 33bfea31b0
commit c9f3174075
10 changed files with 105 additions and 51 deletions

View File

@@ -5,6 +5,7 @@ local clear, funcs, meths = helpers.clear, helpers.funcs, helpers.meths
local iswin = helpers.iswin
local ok = helpers.ok
local matches = helpers.matches
local expect_err = helpers.expect_err
local function clear_serverlist()
for _, server in pairs(funcs.serverlist()) do
@@ -89,19 +90,20 @@ describe('server', function()
s = funcs.serverstart(v4)
if #s > 0 then
table.insert(expected, v4)
funcs.serverstart(v4) -- exists already; ignore
pcall(funcs.serverstart, v4) -- exists already; ignore
end
local v6 = '::1:12345'
s = funcs.serverstart(v6)
if #s > 0 then
table.insert(expected, v6)
funcs.serverstart(v6) -- exists already; ignore
pcall(funcs.serverstart, v6) -- exists already; ignore
end
eq(expected, funcs.serverlist())
clear_serverlist()
funcs.serverstart('127.0.0.1:65536') -- invalid port
expect_err('Failed to start server: invalid argument',
funcs.serverstart, '127.0.0.1:65536') -- invalid port
eq({}, funcs.serverlist())
end)