summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster/exceptions.py
diff options
context:
space:
mode:
authorNigel Babu <nigelb@redhat.com>2016-12-20 12:52:25 +0530
committerNigel Babu <nigelb@redhat.com>2017-02-01 12:48:22 +0530
commited2dfbe2e0b10a8595d0161dbb2190f0f702c0ab (patch)
tree3061897b209ff46f65ca97dd37c6fb05a539560e /glustolibs-gluster/glustolibs/gluster/exceptions.py
parent86f5e76e38e6aefce88917ee88c2eeaf18431046 (diff)
Raise custom exceptions rather assert failures
The setup should never raise an assert failure in a test. Only tests should fail an assert. If an essential test setup doesn't work, we should be raising custom exceptions instead. Change-Id: I6d5cce448132b71b6fde3a39fef894be8b1216d3 Signed-off-by: Nigel Babu <nigelb@redhat.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/exceptions.py')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/exceptions.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/exceptions.py b/glustolibs-gluster/glustolibs/gluster/exceptions.py
new file mode 100644
index 000000000..71591bf7b
--- /dev/null
+++ b/glustolibs-gluster/glustolibs/gluster/exceptions.py
@@ -0,0 +1,17 @@
+class ConfigError(Exception):
+ '''
+ Custom exception thrown when there is an unrecoverable configuration error.
+ For example, a required configuration key is not found.
+ '''
+ pass
+
+
+class ExecutionError(Exception):
+ '''
+ Custom exception thrown when a command executed by Glusto results in an
+ unrecoverable error.
+
+ For example, all hosts are not in peer state or a volume canot be setup.
+
+ '''
+ pass