summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-01-06 18:38:07 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-01-06 19:41:18 +0900
commit18dcbc87c5048371da72788277d8e3a384c02b74 (patch)
tree002fd50f8117cce8872de2edd7e77003e465ace5
parenteb34ee2d8e77c9df979d347e746d6a308c3410c7 (diff)
downloadbuildstream-18dcbc87c5048371da72788277d8e3a384c02b74.tar.gz
_pipeline.py: Raise detailed pipeline error at preflight time
If a plugin raises an error, prepend the plugin identifier to the error message and raise PipelineError.
-rw-r--r--buildstream/_pipeline.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py
index 41f4b8cce..f2515776d 100644
--- a/buildstream/_pipeline.py
+++ b/buildstream/_pipeline.py
@@ -30,7 +30,7 @@ from operator import itemgetter
from pluginbase import PluginBase
from tempfile import TemporaryDirectory
-from ._exceptions import PipelineError, ArtifactError, ImplError
+from ._exceptions import PipelineError, ArtifactError, ImplError, BstError
from ._message import Message, MessageType
from ._elementfactory import ElementFactory
from ._loader import Loader
@@ -152,7 +152,16 @@ class Pipeline():
def preflight(self):
for plugin in self.dependencies(Scope.ALL, include_sources=True):
- plugin.preflight()
+ try:
+ plugin.preflight()
+ except BstError as e:
+ # Prepend the plugin identifier string to the error raised by
+ # the plugin so that users can more quickly identify the issue
+ # that a given plugin is encountering.
+ #
+ # Propagate the original error reason for test case purposes
+ #
+ raise PipelineError("{}: {}".format(plugin, e), reason=e.reason) from e
def initialize_workspaces(self):
for element_name, source, workspace in self.project._list_workspaces():