From 7af99329315545d11d91075de757aed2d4240786 Mon Sep 17 00:00:00 2001 From: Ben Steffen Date: Tue, 26 Nov 2019 12:08:56 -0500 Subject: [PATCH] Rename InvirtException to more descriptive PathResolutionException --- scripts/invirt-getconf | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/invirt-getconf b/scripts/invirt-getconf index b0a1896..07e475b 100755 --- a/scripts/invirt-getconf +++ b/scripts/invirt-getconf @@ -23,7 +23,7 @@ import yaml import invirt -class InvirtException(Exception): +class PathResolutionException(Exception): pass @@ -45,22 +45,20 @@ def main(): try: component = int(component) except ValueError: - raise InvirtException(f'{progress}: node a list; integer path component required, ' + raise PathResolutionException(f'{progress}: node is a list; integer path component required, ' 'but got "{component}"') try: conf = conf[component] except IndexError: - raise InvirtException(f'{progress}: index {component} out of range') + raise PathResolutionException(f'{progress}: index {component} out of range') elif isinstance(conf, dict): try: conf = conf[component] except KeyError: - raise InvirtException(f'{progress}: key "{component}" not found') - except IndexError: - raise InvirtException(f'{progress}: index {component} out of range') + raise PathResolutionException(f'{progress}: key "{component}" not found') else: - raise InvirtException(f'{progress}: node has no children (atomic datum)') + raise PathResolutionException(f'{progress}: node has no children (atomic datum)') if args.ls: if isinstance(conf, list): @@ -70,7 +68,7 @@ def main(): for k in conf: print(k) else: - raise InvirtException(f'{".".join(components)}: node has no children (atomic datum)') + raise PathResolutionException(f'{".".join(components)}: node has no children (atomic datum)') else: if isinstance(conf, (dict, list)): print(conf) -- 1.7.9.5