From 11dffaef4b75806b166db1a46b520e6d147d7969 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Sun, 29 Apr 2018 15:46:13 +0900 Subject: _stream.py: Add StreamError exception Use Stream error for Stream errors. --- buildstream/_exceptions.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'buildstream/_exceptions.py') 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 -- cgit v1.2.1