summaryrefslogtreecommitdiff
path: root/buildstream/element.py
diff options
context:
space:
mode:
authorJosh Smith <joshsmith@codethink.co.uk>2018-07-23 11:33:31 +0100
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-07-27 13:41:26 +0900
commit9ebd7fe1182a4d6afa027b88fb3d096408d9a912 (patch)
tree5d646889a356fea05f1dccf9b42e3f1ad10b585b /buildstream/element.py
parent8c9fd9e40f5ac2902a500c46d5321ab16f6e30b7 (diff)
downloadbuildstream-9ebd7fe1182a4d6afa027b88fb3d096408d9a912.tar.gz
_exceptions.py: Modify BstError API to allow optional retry
job.py: Changes to the logic surrounding retry attempts and child process return codes element.py, source.py: ElementError and SourceError also implement this change. These exceptions now have an optional parameter of temporary which defaults to false. This will potentially break backwards compatibility where exceptions were previously raised and a retry was intended. To trigger a retry, one must now raise their SourceError or ElementError with temporary=True. This aims to fix #397.
Diffstat (limited to 'buildstream/element.py')
-rw-r--r--buildstream/element.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index e9cbdb63e..962ba1c78 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -140,9 +140,10 @@ class ElementError(BstError):
message (str): The error message to report to the user
detail (str): A possibly multiline, more detailed error message
reason (str): An optional machine readable reason string, used for test cases
+ temporary(bool): An indicator to whether the error may occur if the operation was run again. (*Since: 1.4*)
"""
- def __init__(self, message, *, detail=None, reason=None):
- super().__init__(message, detail=detail, domain=ErrorDomain.ELEMENT, reason=reason)
+ def __init__(self, message, *, detail=None, reason=None, temporary=False):
+ super().__init__(message, detail=detail, domain=ErrorDomain.ELEMENT, reason=reason, temporary=temporary)
class Element(Plugin):