summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildstream/_exceptions.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/buildstream/_exceptions.py b/buildstream/_exceptions.py
index 8dd57b617..da6a81365 100644
--- a/buildstream/_exceptions.py
+++ b/buildstream/_exceptions.py
@@ -79,11 +79,16 @@ class ErrorDomain(Enum):
#
class BstError(Exception):
- def __init__(self, message, *, domain=None, reason=None):
+ def __init__(self, message, *, detail=None, domain=None, reason=None):
global _last_exception
super().__init__(message)
+ # Additional error detail, these are used to construct detail
+ # portions of the logging messages when encountered.
+ #
+ self.detail = detail
+
# The build sandbox in which the error occurred, if the
# error occurred at element assembly time.
#
@@ -210,7 +215,7 @@ class ArtifactError(BstError):
#
class PipelineError(BstError):
- def __init__(self, message=None, reason=None):
+ def __init__(self, message=None, *, detail=None, reason=None):
# The empty string should never appear to a user,
# this only allows us to treat this internal error as
@@ -218,4 +223,4 @@ class PipelineError(BstError):
if message is None:
message = ""
- super().__init__(message, domain=ErrorDomain.PIPELINE, reason=reason)
+ super().__init__(message, detail=detail, domain=ErrorDomain.PIPELINE, reason=reason)