From e0efbc6e03f1d64e49805bb9be7d41ff9a27569f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 1 Oct 2024 06:27:30 +0800 Subject: [PATCH] refactor: use ERROR_SET() to check for error (#30594) Replaces the only two places where kErrorTypeNone is checked explicitly. --- src/nvim/getchar.c | 2 +- src/nvim/mapping.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 8c3ac49adf..472bc3a850 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -3181,7 +3181,7 @@ bool map_execute_lua(bool may_repeat) Error err = ERROR_INIT; Array args = ARRAY_DICT_INIT; nlua_call_ref(ref, NULL, args, kRetNilBool, NULL, &err); - if (err.type != kErrorTypeNone) { + if (ERROR_SET(&err)) { semsg_multiline("E5108: %s", err.msg); api_clear_error(&err); } diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c index 8080280da6..e055ebc2fa 100644 --- a/src/nvim/mapping.c +++ b/src/nvim/mapping.c @@ -1651,7 +1651,7 @@ char *eval_map_expr(mapblock_T *mp, int c) p = string_to_cstr(ret.data.string); } api_free_object(ret); - if (err.type != kErrorTypeNone) { + if (ERROR_SET(&err)) { semsg_multiline("E5108: %s", err.msg); api_clear_error(&err); }