From: Arran Cudbard-Bell Date: Fri, 29 Jan 2021 17:44:01 +0000 (+0000) Subject: More helpful error messages X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9063c165f7058b7184b84f9a2073a05ebf60598b;p=thirdparty%2Ffreeradius-server.git More helpful error messages --- diff --git a/src/lib/server/cond_tokenize.c b/src/lib/server/cond_tokenize.c index 50b55f147d..e177a01d04 100644 --- a/src/lib/server/cond_tokenize.c +++ b/src/lib/server/cond_tokenize.c @@ -468,7 +468,7 @@ int fr_cond_promote_types(fr_cond_t *c, fr_sbuff_t *in, fr_sbuff_marker_t *m_lhs } cast_type = fr_type_promote(lhs_type, rhs_type); - fr_assert(cast_type != FR_TYPE_INVALID); + if (!fr_cond_assert_msg(cast_type != FR_TYPE_INVALID, "%s", fr_strerror())) return -1; set_types: /* diff --git a/src/lib/util/types.c b/src/lib/util/types.c index e050906931..d217c4454b 100644 --- a/src/lib/util/types.c +++ b/src/lib/util/types.c @@ -22,7 +22,9 @@ */ RCSID("$Id$") +#include #include +#include #define O(_x) [FR_TYPE_ ## _x] = true @@ -423,9 +425,20 @@ fr_type_t fr_type_promote(fr_type_t a, fr_type_t b) /* * Otherwise bad things happen. :( */ - if (unlikely(type_promote_table[a][b] != type_promote_table[b][a])) return FR_TYPE_INVALID; + if (unlikely(type_promote_table[a][b] != type_promote_table[b][a])) { + fr_strerror_printf("Inverse type mapping inconsistent for a = %s, b = %s", + fr_table_str_by_value(fr_value_box_type_table, a, ""), + fr_table_str_by_value(fr_value_box_type_table, b, "")); - if (unlikely(type_promote_table[a][b] == FR_TYPE_INVALID)) return FR_TYPE_INVALID; + return FR_TYPE_INVALID; + } + + if (unlikely(type_promote_table[a][b] == FR_TYPE_INVALID)) { + fr_strerror_printf("No type promotions for a = %s, b = %s", + fr_table_str_by_value(fr_value_box_type_table, a, ""), + fr_table_str_by_value(fr_value_box_type_table, b, "")); + return FR_TYPE_INVALID; + } /* * That takes care of the simple cases. :( Now to the