summaryrefslogtreecommitdiff
path: root/buildstream/source.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-12-29 18:42:20 -0500
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-12-29 18:42:20 -0500
commit3c75781b9d68b7b1958082a0f75a2fc5db774418 (patch)
tree3c98c338f86bf9d2c4a99c4c05748f19f56d9135 /buildstream/source.py
parente5eb337a466949eebb7fafa08a1d1f57742f5c85 (diff)
downloadbuildstream-3c75781b9d68b7b1958082a0f75a2fc5db774418.tar.gz
Exceptions refactoring
Outline of changes to exceptions: o Now BstError base class has a `domain` and `reason` member, reason members are optional. o All derived error classes now specify their `domain` o For LoadError, LoadErrorReason defines the error's `reason` o Now the scheduler `job` class takes care of sending the error reason and domain back to the main process where the last exception which caused a child task to fail can be discretely stored.
Diffstat (limited to 'buildstream/source.py')
-rw-r--r--buildstream/source.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/buildstream/source.py b/buildstream/source.py
index f610e90af..63d8ffafd 100644
--- a/buildstream/source.py
+++ b/buildstream/source.py
@@ -27,7 +27,7 @@ from contextlib import contextmanager
from . import Plugin
from . import _yaml, utils
-from ._exceptions import BstError, ImplError, LoadError, LoadErrorReason
+from ._exceptions import BstError, ImplError, LoadError, LoadErrorReason, ErrorDomain
class Consistency():
@@ -58,7 +58,8 @@ class SourceError(BstError):
This exception is raised when a :class:`.Source` encounters an error.
"""
- pass
+ def __init__(self, message, reason=None):
+ super().__init__(message, domain=ErrorDomain.SOURCE, reason=reason)
class Source(Plugin):