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:46:57 +0900
commit2df05bd16b375d559c6308226434f020b095d2b8 (patch)
tree13f2135abfcca5beab9f79a89a6c594b16e493f2
parent07e4d5434f07095535ca23efca3c18b93503ee2f (diff)
downloadbuildstream-2df05bd16b375d559c6308226434f020b095d2b8.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)