From bd428790ce21547215378682e9f9a7b69c5e3e43 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 11 Feb 2022 14:51:53 -0500 Subject: [PATCH] Try for more informative messoge an expression syntax error --- .../confluent/plugins/configuration/attributes.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/plugins/configuration/attributes.py b/confluent_server/confluent/plugins/configuration/attributes.py index 3d7afc58..c2ea83d9 100644 --- a/confluent_server/confluent/plugins/configuration/attributes.py +++ b/confluent_server/confluent/plugins/configuration/attributes.py @@ -218,7 +218,12 @@ def _expand_expression(nodes, configmanager, inputdata): pernodeexpressions[expanded[0]] = expanded[1] for node in util.natural_sort(pernodeexpressions): yield msg.KeyValueData({'value': pernodeexpressions[node]}, node) - except (SyntaxError, ValueError) as e: + except SyntaxError as e: + markup = (e.text[:e.offset-1] + '-->' + e.text[e.offset-1] + '<--' + e.text[e.offset:]).strip() + raise exc.InvalidArgumentException( + 'Bad confluent expression syntax (must use "{{" and "}}" if not ' + 'desiring confluent expansion): ' + markup) + except ValueError as e: raise exc.InvalidArgumentException( 'Bad confluent expression syntax (must use "{{" and "}}" if not ' 'desiring confluent expansion): ' + str(e))