aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-12-16 08:34:16 -0800
committerGitHub <noreply@github.com>2024-12-16 08:34:16 -0800
commit022449b5223659d515b78bada7de2fac8718820a (patch)
tree2ce4dd7b21d2ba4089308b877608f4dbc4166d99 /runtime
parentfb8372adb3b9f50d4d18eba6f650c3728353ab00 (diff)
downloadrneovim-022449b5223659d515b78bada7de2fac8718820a.tar.gz
rneovim-022449b5223659d515b78bada7de2fac8718820a.tar.bz2
rneovim-022449b5223659d515b78bada7de2fac8718820a.zip
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.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/api.txt8
-rw-r--r--runtime/lua/vim/_meta/api.lua6
2 files changed, 5 insertions, 9 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index cb3b2a3f77..70fda5ce8a 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -1647,11 +1647,9 @@ nvim_command({command}) *nvim_command()*
On execution error: fails with Vimscript error, updates v:errmsg.
- Prefer using |nvim_cmd()| or |nvim_exec2()| over this. To evaluate
- multiple lines of Vim script or an Ex command directly, use
- |nvim_exec2()|. To construct an Ex command using a structured format and
- then execute it, use |nvim_cmd()|. To modify an Ex command before
- evaluating it, use |nvim_parse_cmd()| in conjunction with |nvim_cmd()|.
+ Prefer |nvim_cmd()| or |nvim_exec2()| instead. To modify an Ex command in
+ a structured way before executing it, modify the result of
+ |nvim_parse_cmd()| then pass it to |nvim_cmd()|.
Parameters: ~
• {command} Ex command string
diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua
index b2385197bd..55274963ed 100644
--- a/runtime/lua/vim/_meta/api.lua
+++ b/runtime/lua/vim/_meta/api.lua
@@ -885,10 +885,8 @@ function vim.api.nvim_cmd(cmd, opts) end
---
--- On execution error: fails with Vimscript error, updates v:errmsg.
---
---- Prefer using `nvim_cmd()` or `nvim_exec2()` over this. To evaluate multiple lines of Vim script
---- or an Ex command directly, use `nvim_exec2()`. To construct an Ex command using a structured
---- format and then execute it, use `nvim_cmd()`. To modify an Ex command before evaluating it, use
---- `nvim_parse_cmd()` in conjunction with `nvim_cmd()`.
+--- Prefer `nvim_cmd()` or `nvim_exec2()` instead. To modify an Ex command in a structured way
+--- before executing it, modify the result of `nvim_parse_cmd()` then pass it to `nvim_cmd()`.
---
--- @param command string Ex command string
function vim.api.nvim_command(command) end