[Piglit] [PATCH 2/3] framework/exceptions: Add an exception class for user errors
Dylan Baker
dylan at pnwbakers.com
Wed Apr 12 17:55:05 UTC 2017
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 at intel.com>
---
framework/exceptions.py | 11 +++++++++++
1 file changed, 11 insertions(+)
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.
--
2.12.2
More information about the Piglit
mailing list