]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: If settings_get*() fails, always include settings struct name and filte...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 12 Mar 2024 20:52:51 +0000 (22:52 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:39:58 +0000 (10:39 +0200)
This can help understand where the error is coming from.

src/lib-settings/settings.c

index 77e47bf2df0da3eee1ac7432fc990f762bd59ff3..6738d173a78c497146513094799bbf60a65ff517 100644 (file)
@@ -1659,8 +1659,8 @@ settings_instance_get(struct settings_apply_ctx *ctx,
        if ((ctx->flags & SETTINGS_GET_FLAG_NO_CHECK) == 0) {
                if (!settings_check(ctx->event, ctx->info, *pool_p,
                                    ctx->set_struct, error_r)) {
-                       *error_r = t_strdup_printf("Invalid %s settings: %s",
-                                                  ctx->info->name, *error_r);
+                       *error_r = t_strdup_printf("Invalid settings: %s",
+                                                  *error_r);
                        pool_unref(&set_pool);
                        return -1;
                }
@@ -1760,6 +1760,12 @@ settings_get_full(struct event *event,
                ret = settings_instance_get(&ctx, source_filename, source_linenum,
                                            set_r, error_r);
        } T_END_PASS_STR_IF(ret < 0, error_r);
+       if (ret < 0) {
+               *error_r = t_strdup_printf("%s settings%s: %s", info->name,
+                       filter_name == NULL ? "" :
+                       t_strdup_printf(" (filter=%s)", filter_name),
+                       *error_r);
+       }
        settings_parser_unref(&ctx.parser);
        event_unref(&lookup_event);
        array_free(&ctx.set_seen);