diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-01-06 18:38:07 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-01-06 19:26:43 +0900 |
commit | f1183059abac95ba1f90a54ba02b69326cefe84d (patch) | |
tree | 05e3740d66f94dbe4cd1ede103bf6a7ce6e064fe | |
parent | ee8cfafb929b322e1a1d5d2a0edec0040269c226 (diff) | |
download | buildstream-f1183059abac95ba1f90a54ba02b69326cefe84d.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.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py index 5afb42f52..28e64c78f 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(): |