From 1ca624806a4d740c242b4c38c08bf0547e2ab750 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Sat, 26 Apr 2025 09:11:38 -0400 Subject: [PATCH] print out error via RPEDEBUG when calculating a result --- src/lib/unlang/xlat_expr.c | 1 + src/tests/unit/xlat/cond_base.txt | 5 ++++- src/tests/xlat/expr.txt | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/unlang/xlat_expr.c b/src/lib/unlang/xlat_expr.c index 0828c3afc6..d40d2b5b49 100644 --- a/src/lib/unlang/xlat_expr.c +++ b/src/lib/unlang/xlat_expr.c @@ -350,6 +350,7 @@ static xlat_action_t xlat_binary_op(TALLOC_CTX *ctx, fr_dcursor_t *out, rcode = fr_value_calc_binary_op(dst, dst, default_type, a, op, b); if (rcode < 0) { + RPEDEBUG("Failed calculating '%pV %s %pV'", a, fr_tokens[op], b); talloc_free(dst); return XLAT_ACTION_FAIL; } diff --git a/src/tests/unit/xlat/cond_base.txt b/src/tests/unit/xlat/cond_base.txt index 01243d8cd8..e41ce2ee43 100644 --- a/src/tests/unit/xlat/cond_base.txt +++ b/src/tests/unit/xlat/cond_base.txt @@ -33,8 +33,11 @@ match ERROR offset 3: Unexpected text after return code # # 0 - 111 is smaller than zero, and Service-Type is uint32. # +# Except the error is printed out via RPEDEBUG, and is thus unavailable +# to the unit tests +# xlat_purify (Service-Type == 000-111) -match ERROR purifying node - Value underflows 'uint64' when calculating result. +match ERROR purifying node - # # @todo - this should really be hoisted diff --git a/src/tests/xlat/expr.txt b/src/tests/xlat/expr.txt index ead2644103..45906b2195 100644 --- a/src/tests/xlat/expr.txt +++ b/src/tests/xlat/expr.txt @@ -85,8 +85,12 @@ xlat_expr (uint8) 1 << 8 match 256 # Cannot perform any operations for destination type ether +# +# Except the error is printed out via RPEDEBUG, and is thus unavailable +# to the unit tests +# xlat_expr 00:01:02:03:04:05 ^ 11:22:33:44:55:66 -match ERROR expanding xlat: Invalid operation on data types - 'ether' ^ 'ether' +match ERROR expanding xlat: no error provided # # NAS-IP-Address doesn't exist. -- 2.47.2