From 90af99e864751793a3835699da53bcde8150e4e7 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 14 Feb 2023 14:51:46 -0500 Subject: [PATCH] Add more clear error on syncfile mistake If a bad node was included in a syncfile, the error was highly misleading. Provide a more clear indicaiton of the problem on failure. --- confluent_server/confluent/syncfiles.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/confluent_server/confluent/syncfiles.py b/confluent_server/confluent/syncfiles.py index b3c68ff3..556d9bcf 100644 --- a/confluent_server/confluent/syncfiles.py +++ b/confluent_server/confluent/syncfiles.py @@ -98,11 +98,14 @@ class SyncList(object): v = v.strip() if ':' in v: nr, v = v.split(':', 1) - for candidate in noderange.NodeRange(nr, cfg).nodes: - if candidate == nodename: - break - else: - continue + try: + for candidate in noderange.NodeRange(nr, cfg).nodes: + if candidate == nodename: + break + else: + continue + except Exception as e: + raise Exception('Error on syncfile line "{}": {}'.format(ent, str(e))) optparts = v.split() v = optparts[0] optparts = optparts[1:]