Skip to content

fix: use descriptive error for unknown block options in health and log#8128

Merged
yongtang merged 1 commit into
coredns:masterfrom
immanuwell:fix-health-log-unknown-property
May 27, 2026
Merged

fix: use descriptive error for unknown block options in health and log#8128
yongtang merged 1 commit into
coredns:masterfrom
immanuwell:fix-health-log-unknown-property

Conversation

@immanuwell

Copy link
Copy Markdown
Contributor

When you typo a block option in health or log, the error you get back is kinda useless:

Wrong argument count or unexpected line ending after 'lamedudk'

That's c.ArgErr(), which is meant for wrong arg counts -- not unknown properties. So the user has no clue what's actually wrong.

Reproduce:

health localhost:8080 {
    lamedudk 5s
}

or

log {
    clss denial
}

Both silently give a misleading error instead of saying "hey, that option doesn't exist".

Fix: swap c.ArgErr() for c.Errf("unknown property '%s'", c.Val()) in the default cases of those two setup parsers, same as was done in #8119, #8120, #8121.

After fix:

unknown property 'lamedudk'

…g plugins

Signed-off-by: immanuwell <pchpr.00@list.ru>
@yongtang yongtang merged commit 0bcb17d into coredns:master May 27, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants