Skip to content

Commit

Permalink
better error messages
Browse files Browse the repository at this point in the history
If I run into a problem because of a typo, and the error message
isn't clear enough to me, then it should be clarified for others, too
  • Loading branch information
alandekok committed Nov 21, 2024
1 parent 052f5ed commit fa7b671
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/server/cf_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -2559,7 +2559,15 @@ static int parse_input(cf_stack_t *stack)
*/
parse_name2:
if (!(isalpha((uint8_t) *ptr) || isdigit((uint8_t) *ptr) || (*(uint8_t const *) ptr >= 0x80))) {
return parse_error(stack, ptr, "Invalid second name for configuration section");
/*
* Maybe they missed a closing brace somewhere?
*/
name2_token = gettoken(&ptr, buff[2], stack->bufsize, false); /* can't be EOL */
if (fr_assignment_op[name2_token]) {
return parse_error(stack, ptr2, "Unexpected operator, was expecting a configuration section. Is there a missing '}' somewhere?");
}

return parse_error(stack, ptr2, "Invalid second name for configuration section");
}

name2_token = gettoken(&ptr, buff[2], stack->bufsize, false); /* can't be EOL */
Expand Down

0 comments on commit fa7b671

Please sign in to comment.