diff options
author | Cole Robinson <crobinso@redhat.com> | 2020-07-17 18:58:00 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2020-07-17 19:08:27 -0400 |
commit | aa89a48371e304fed53f4b0f07dd7b9a6b173952 (patch) | |
tree | ca744a7630fb2d6b81ce2963181edd4c8ff0f51e /virtinst/xmlutil.py | |
parent | 380a44318a60ef99f064103b55298c4f2b534fe6 (diff) | |
download | virt-manager-aa89a48371e304fed53f4b0f07dd7b9a6b173952.tar.gz |
xmlutil: Centralize all 'programming error' exceptions
Raise them directly instead of adding the hard to read conditional
into the function
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Diffstat (limited to 'virtinst/xmlutil.py')
-rw-r--r-- | virtinst/xmlutil.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/virtinst/xmlutil.py b/virtinst/xmlutil.py index fb5a2856..7ef0ef03 100644 --- a/virtinst/xmlutil.py +++ b/virtinst/xmlutil.py @@ -8,6 +8,11 @@ import os +class DevError(RuntimeError): + def __init__(self, msg): + RuntimeError.__init__(self, "programming error: %s" % msg) + + def listify(l): if l is None: return [] @@ -61,13 +66,5 @@ def set_prop_path(obj, prop_path, value): return setattr(parent, pieces[-1], value) -def raise_programming_error(cond, msg): - """ - Small helper to raise a consistent error message for coding issues - """ - if cond: - raise RuntimeError("programming error: %s" % msg) - - def in_testsuite(): return "VIRTINST_TEST_SUITE" in os.environ |