summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-01-04 18:46:57 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-01-04 18:51:07 +0900
commit533a81219bf1294770eaf84dfd4b92bc5240eb44 (patch)
tree13f2135abfcca5beab9f79a89a6c594b16e493f2
parenta04c9959d4e31c7b4761e1ff994edddec0f0a99d (diff)
downloadbuildstream-533a81219bf1294770eaf84dfd4b92bc5240eb44.tar.gz
source.py & element.py: Fixing SourceError() and ElementError() constructors.
Recently I added the `reason` member which can be used to set machine readable error reason strings for the purpose of testing. Forgot to add the necessary `*` argument, forcing `reason` to be a keyword-only argument.
-rw-r--r--buildstream/element.py9
-rw-r--r--buildstream/source.py9
2 files changed, 12 insertions, 6 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index ee056f39c..195365390 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -80,11 +80,14 @@ class Scope(Enum):
class ElementError(BstError):
- """Raised by Element implementations.
+ """This exception should be raised by :class:`.Element` implementations
+ to report errors to the user.
- This exception is raised when an :class:`.Element` encounters an error.
+ Args:
+ message (str): The error message to report to the user
+ reason (str): An optional machine readable reason string, used for test cases
"""
- def __init__(self, message, reason=None):
+ def __init__(self, message, *, reason=None):
super().__init__(message, domain=ErrorDomain.ELEMENT, reason=reason)
diff --git a/buildstream/source.py b/buildstream/source.py
index bfea143ae..5f41fa1a1 100644
--- a/buildstream/source.py
+++ b/buildstream/source.py
@@ -54,11 +54,14 @@ class Consistency():
class SourceError(BstError):
- """Raised by Source implementations.
+ """This exception should be raised by :class:`.Source` implementations
+ to report errors to the user.
- This exception is raised when a :class:`.Source` encounters an error.
+ Args:
+ message (str): The error message to report to the user
+ reason (str): An optional machine readable reason string, used for test cases
"""
- def __init__(self, message, reason=None):
+ def __init__(self, message, *, reason=None):
super().__init__(message, domain=ErrorDomain.SOURCE, reason=reason)