diff options
author | Josh Smith <joshsmith@codethink.co.uk> | 2018-07-23 11:33:31 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-07-27 13:41:26 +0900 |
commit | 9ebd7fe1182a4d6afa027b88fb3d096408d9a912 (patch) | |
tree | 5d646889a356fea05f1dccf9b42e3f1ad10b585b /buildstream/_exceptions.py | |
parent | 8c9fd9e40f5ac2902a500c46d5321ab16f6e30b7 (diff) | |
download | buildstream-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/_exceptions.py')
-rw-r--r-- | buildstream/_exceptions.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/buildstream/_exceptions.py b/buildstream/_exceptions.py index 8baf16706..ada697a53 100644 --- a/buildstream/_exceptions.py +++ b/buildstream/_exceptions.py @@ -99,7 +99,7 @@ class ErrorDomain(Enum): # class BstError(Exception): - def __init__(self, message, *, detail=None, domain=None, reason=None): + def __init__(self, message, *, detail=None, domain=None, reason=None, temporary=False): global _last_exception super().__init__(message) @@ -114,6 +114,11 @@ class BstError(Exception): # self.sandbox = None + # When this exception occurred during the handling of a job, indicate + # whether or not there is any point retrying the job. + # + self.temporary = temporary + # Error domain and reason # self.domain = domain |