mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(api): generic error messages, not using TRY_WRAP #31596
Problem: - API functions using `try_start` directly, do not surface the underlying error message, and instead show generic messages. - Error-handling code is duplicated in the API impl. - Failure modes are not tested. Solution: - Use `TRY_WRAP`. - Add tests.
This commit is contained in:
@@ -3955,6 +3955,17 @@ stack traceback:
|
||||
eq(win2, val)
|
||||
end)
|
||||
|
||||
it('failure modes', function()
|
||||
matches(
|
||||
'nvim_exec2%(%): Vim:E492: Not an editor command: fooooo',
|
||||
pcall_err(exec_lua, [[vim.api.nvim_win_call(0, function() vim.cmd 'fooooo' end)]])
|
||||
)
|
||||
eq(
|
||||
'Error executing lua: [string "<nvim>"]:0: fooooo',
|
||||
pcall_err(exec_lua, [[vim.api.nvim_win_call(0, function() error('fooooo') end)]])
|
||||
)
|
||||
end)
|
||||
|
||||
it('does not cause ml_get errors with invalid visual selection', function()
|
||||
-- Add lines to the current buffer and make another window looking into an empty buffer.
|
||||
exec_lua [[
|
||||
|
Reference in New Issue
Block a user