mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
CLEANUP: vars: make the error message clearer on missing arguments for set-var
The error message after "http-response set-var" isn't very clear: [ALERT] 070/115043 (30526) : parsing [/dev/stdin:2] : error detected in proxy 'f' while parsing 'http-response set-var' rule : invalid variable 'set-var'. Expects 'set-var(<var-name>)' or 'unset-var(<var-name>)'. Let's change it to this instead: [ALERT] 070/115608 (30799) : parsing [/dev/stdin:2] : error detected in proxy 'f' while parsing 'http-response set-var' rule : invalid or incomplete action 'set-var'. Expects 'set-var(<var-name>)' or 'unset-var(<var-name>)'. With a wrong action name, it also works better (it's handled as a prefix due to the opening parenthesis): [ALERT] 070/115608 (30799) : parsing [/dev/stdin:2] : error detected in proxy 'f' while parsing 'http-response set-varxxx' rule : invalid or incomplete action 'set-varxxx'. Expects 'set-var(<var-name>)' or 'unset-var(<var-name>)'.
This commit is contained in:
parent
72d012fbd9
commit
3d1d178933
@ -737,7 +737,7 @@ static enum act_parse_ret parse_store(const char **args, int *arg, struct proxy
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*var_name != '(') {
|
if (*var_name != '(') {
|
||||||
memprintf(err, "invalid variable '%s'. Expects 'set-var(<var-name>)' or 'unset-var(<var-name>)'",
|
memprintf(err, "invalid or incomplete action '%s'. Expects 'set-var(<var-name>)' or 'unset-var(<var-name>)'",
|
||||||
args[*arg-1]);
|
args[*arg-1]);
|
||||||
return ACT_RET_PRS_ERR;
|
return ACT_RET_PRS_ERR;
|
||||||
}
|
}
|
||||||
@ -745,7 +745,7 @@ static enum act_parse_ret parse_store(const char **args, int *arg, struct proxy
|
|||||||
var_len = strlen(var_name);
|
var_len = strlen(var_name);
|
||||||
var_len--; /* remove the ')' */
|
var_len--; /* remove the ')' */
|
||||||
if (var_name[var_len] != ')') {
|
if (var_name[var_len] != ')') {
|
||||||
memprintf(err, "invalid variable '%s'. Expects 'set-var(<var-name>)' or 'unset-var(<var-name>)'",
|
memprintf(err, "incomplete expression after action '%s'. Expects 'set-var(<var-name>)' or 'unset-var(<var-name>)'",
|
||||||
args[*arg-1]);
|
args[*arg-1]);
|
||||||
return ACT_RET_PRS_ERR;
|
return ACT_RET_PRS_ERR;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user