summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-04-12 10:50:10 -0700
committerDylan Baker <dylan@pnwbakers.com>2017-04-13 10:33:55 -0700
commit39e9075fd83ea01d3f72c28a1e838df2c29059df (patch)
tree1ed928ae7dc511b2505dc3b6ae5c2e9a6ca13096 /framework
parente483f3798485e7a3e13bfb54c7957a500c46346e (diff)
framework/exceptions: Add an exception class for user errors
It's nice to separate "something internally went wrong" and "you mis-configured or passed bad flags". Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/exceptions.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/framework/exceptions.py b/framework/exceptions.py
index ffee7f315..6ca3ed773 100644
--- a/framework/exceptions.py
+++ b/framework/exceptions.py
@@ -56,6 +56,9 @@ def handler(func):
print('Aborting Piglit execution: {}'.format(str(e)),
file=sys.stderr)
sys.exit(3)
+ except PiglitUserError as e:
+ print('User error: {}'.format(str(e)), file=sys.stderr)
+ sys.exit(1)
return _inner
@@ -94,6 +97,14 @@ class PiglitFatalError(Exception):
"""
+class PiglitUserError(Exception):
+ """Class for user configuration errors.
+
+ When this class (or a subclass) is raised it should be raised all the way
+ to the top of the program where it exits.
+ """
+
+
class PiglitAbort(Exception):
"""Class for non-errors that require piglit aborting.