diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-04-29 15:46:13 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-05-08 03:59:38 +0900 |
commit | 11dffaef4b75806b166db1a46b520e6d147d7969 (patch) | |
tree | a9d370b13b8d22435c81607a6e0e9ea0085cd2a3 /buildstream/_exceptions.py | |
parent | 2390c81411aee2019cec891ea0be5247e779bc2e (diff) | |
download | buildstream-11dffaef4b75806b166db1a46b520e6d147d7969.tar.gz |
_stream.py: Add StreamError exception
Use Stream error for Stream errors.
Diffstat (limited to 'buildstream/_exceptions.py')
-rw-r--r-- | buildstream/_exceptions.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/buildstream/_exceptions.py b/buildstream/_exceptions.py index d8687104f..bcea65a8d 100644 --- a/buildstream/_exceptions.py +++ b/buildstream/_exceptions.py @@ -88,6 +88,7 @@ class ErrorDomain(Enum): SOURCE = 10 ELEMENT = 11 APP = 12 + STREAM = 13 # BstError is an internal base exception class for BuildSream @@ -252,10 +253,20 @@ class ArtifactError(BstError): # PipelineError # -# Raised when a pipeline fails +# Raised from pipeline operations # class PipelineError(BstError): + def __init__(self, message, *, detail=None, reason=None): + super().__init__(message, detail=detail, domain=ErrorDomain.PIPELINE, reason=reason) + + +# StreamError +# +# Raised when a stream operation fails +# +class StreamError(BstError): + def __init__(self, message=None, *, detail=None, reason=None, terminated=False): # The empty string should never appear to a user, @@ -264,7 +275,7 @@ class PipelineError(BstError): if message is None: message = "" - super().__init__(message, detail=detail, domain=ErrorDomain.PIPELINE, reason=reason) + super().__init__(message, detail=detail, domain=ErrorDomain.STREAM, reason=reason) self.terminated = terminated |