aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ui_compositor.c
diff options
context:
space:
mode:
authorAndrew Willette <willette.andrew1846@gmail.com>2022-11-30 14:32:57 -0600
committerGitHub <noreply@github.com>2022-11-30 21:32:57 +0100
commit282dda643ae598d5c8e9f34c379d931563b4891b (patch)
tree251473efe87eac9f2639de56f1afb82f2dda2ea5 /src/nvim/ui_compositor.c
parentef5ab2bf76a8037c3ca87c08d4083e03686fd7a1 (diff)
downloadrneovim-282dda643ae598d5c8e9f34c379d931563b4891b.tar.gz
rneovim-282dda643ae598d5c8e9f34c379d931563b4891b.tar.bz2
rneovim-282dda643ae598d5c8e9f34c379d931563b4891b.zip
fix(ui-ext): log and clear error in ui_comp_event (#21147)
* fix: log and clear error in ui_comp_event * fix: handling error in each map_foreach_value iteration * fix: handling error decl in for_each loop * fix: updating initerr to const, removing initerr free-ing * fix: using ERROR_SET for error check * fix: wrapping ERROR_INIT in parens to allow for including inside macro
Diffstat (limited to 'src/nvim/ui_compositor.c')
-rw-r--r--src/nvim/ui_compositor.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/ui_compositor.c b/src/nvim/ui_compositor.c
index 32bdb7d273..26a17ef747 100644
--- a/src/nvim/ui_compositor.c
+++ b/src/nvim/ui_compositor.c
@@ -706,15 +706,18 @@ static void ui_comp_grid_resize(UI *ui, Integer grid, Integer width, Integer hei
static void ui_comp_event(UI *ui, char *name, Array args)
{
- Error err = ERROR_INIT;
UIEventCallback *event_cb;
bool handled = false;
-
map_foreach_value(&ui_event_cbs, event_cb, {
+ Error err = ERROR_INIT;
Object res = nlua_call_ref(event_cb->cb, name, args, false, &err);
if (res.type == kObjectTypeBoolean && res.data.boolean == true) {
handled = true;
}
+ if (ERROR_SET(&err)) {
+ ELOG("Error while executing ui_comp_event callback: %s", err.msg);
+ }
+ api_clear_error(&err);
})
if (!handled) {