mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 17:28:23 +00:00
fix(api): not using TRY_WRAP, generic error messages #31595
Problem: - API functions using `try_start` directly instead of `TRY_WRAP`, do not surface the underlying error message, and instead show generic things like "Failed to set buffer". - Error handling code is duplicated in the API impl, instead of delegating to the vim buffer/window handling logic. Solution: - Use `TRY_WRAP`.
This commit is contained in:
@@ -59,12 +59,7 @@ void nvim_win_set_buf(Window window, Buffer buffer, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
if (!win || !buf || win->w_buffer == buf) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (win->w_p_wfb) {
|
||||
api_set_error(err, kErrorTypeException, "%s", e_winfixbuf_cannot_go_to_buffer);
|
||||
if (!win || !buf) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user