Skip to content

Commit d56525c

Browse files
committed
be a bit more descriptive about what triggered the error
1 parent 4f41886 commit d56525c

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/lib/server/tmpl_tokenize.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,7 @@ static fr_slen_t tmpl_attr_parse_filter(tmpl_attr_error_t *err, tmpl_attr_t *ar,
15651565
if (slen <= 0) goto error;
15661566

15671567
if (!tmpl_is_attr(ar->ar_tmpl)) {
1568-
fr_strerror_const("Invalid array index");
1568+
fr_strerror_printf("Invalid array index '%s'", ar->ar_tmpl->name);
15691569
goto error;
15701570
}
15711571

src/tests/unit/condition/base.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,10 @@ match (&26.24757.84.9.5.15 == 0x1a99)
526526
# Invalid array references.
527527
#
528528
condition &User-Name[a] == 'bob'
529-
match ERROR offset 12: Invalid array index
529+
match ERROR offset 12: Invalid array index 'a'
530530

531531
condition &User-Name == &Filter-Id[a]
532-
match ERROR offset 26: Invalid array index
532+
match ERROR offset 26: Invalid array index 'a'
533533

534534
#
535535
# Bounds checks...
@@ -538,7 +538,7 @@ condition &User-Name[1001] == 'bob'
538538
match ERROR offset 12: Invalid array index '1001' (should be between 0-1000)
539539

540540
condition &User-Name[-1] == 'bob'
541-
match ERROR offset 12: Invalid array index
541+
match ERROR offset 12: Invalid array index '-1'
542542

543543
#
544544
# Sometimes the attribute/condition parser needs to fallback to bare words

src/tests/unit/condition/filter.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ condition &User-Name[n] == "foo"
2525
match (&User-Name[n] == "foo")
2626

2727
condition &User-Name[-1] == "foo"
28-
match ERROR offset 12: Invalid array index
28+
match ERROR offset 12: Invalid array index '-1'
2929

3030
#
3131
# tmpl_dcursor.c has an assert which fails if you try to use

src/tests/unit/xlat/cond_base.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,10 @@ match ERROR offset 18: Unknown attributes not allowed here
527527
# Invalid array references.
528528
#
529529
xlat_purify &User-Name[a] == 'bob'
530-
match ERROR offset 12: Invalid array index
530+
match ERROR offset 12: Invalid array index 'a'
531531

532532
xlat_purify &User-Name == &Filter-Id[a]
533-
match ERROR offset 26: Invalid array index
533+
match ERROR offset 26: Invalid array index 'a'
534534

535535
#
536536
# Bounds checks...
@@ -539,7 +539,7 @@ xlat_purify &User-Name[1001] == 'bob'
539539
match ERROR offset 12: Invalid array index '1001' (should be between 0-1000)
540540

541541
xlat_purify &User-Name[-1] == 'bob'
542-
match ERROR offset 12: Invalid array index
542+
match ERROR offset 12: Invalid array index '-1'
543543

544544
#
545545
# attributes MUST be prefixed with '&'.

0 commit comments

Comments
 (0)