Commit 91007c3
authored
fix(client-policy): correct ensure_nonempty! error message format (#4491)
The `ensure_nonempty!` macro in `Meta::try_from` produces malformed error
messages when a Resource identity field was empty. The original form
`concat!(stringify!($name, "must not be empty"))` passes both `$name`
and the literal `"must not be empty"` as a single token list to the
`stringify!` macro, which then renders them as source text. The result
is an error string like `<resource>, "must not be empty"` (comma and
double quotes included), instead of `<resource> must not be empty`. The
outer `concat!` wraps a single string, so it becomes a no-op.
Fix this by stringifying only the identifier, then concatenating the
suffix separately: `concat!(stringify!($name), " must not be empty")`.
Signed-off-by: Alejandro Martinez Ruiz <amr@buoyant.io>1 parent c597070 commit 91007c3
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
564 | 564 | | |
565 | 565 | | |
566 | 566 | | |
567 | | - | |
| 567 | + | |
568 | 568 | | |
569 | 569 | | |
570 | 570 | | |
| |||
0 commit comments