summaryrefslogtreecommitdiff
path: root/buildstream/_pipeline.py
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2018-01-10 17:36:17 +0000
committerJonathan Maw <jonathan.maw@codethink.co.uk>2018-01-25 13:27:40 +0000
commit9bf5278a154329befb176cd067a5cf7d2a996575 (patch)
tree2591802179968e7bec7329b25445917407b63925 /buildstream/_pipeline.py
parent2aa233da274ef3ad6bc2f7f832d2df43d71a1eec (diff)
downloadbuildstream-9bf5278a154329befb176cd067a5cf7d2a996575.tar.gz
Add explicit error handling for ElementErrors that happen as a result of staging artifacts
Diffstat (limited to 'buildstream/_pipeline.py')
-rw-r--r--buildstream/_pipeline.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py
index 551861e7c..5894bdaed 100644
--- a/buildstream/_pipeline.py
+++ b/buildstream/_pipeline.py
@@ -516,18 +516,22 @@ class Pipeline():
.format(directory))
# Stage deps into a temporary sandbox first
- with target._prepare_sandbox(Scope.RUN, None, integrate=integrate) as sandbox:
-
- # Copy or move the sandbox to the target directory
- sandbox_root = sandbox.get_directory()
- with target.timed_activity("Checking out files in {}".format(directory)):
- try:
- if hardlinks:
- self.checkout_hardlinks(sandbox_root, directory)
- else:
- utils.copy_files(sandbox_root, directory)
- except OSError as e:
- raise PipelineError("Failed to checkout files: {}".format(e)) from e
+ try:
+ with target._prepare_sandbox(Scope.RUN, None, integrate=integrate) as sandbox:
+
+ # Copy or move the sandbox to the target directory
+ sandbox_root = sandbox.get_directory()
+ with target.timed_activity("Checking out files in {}".format(directory)):
+ try:
+ if hardlinks:
+ self.checkout_hardlinks(sandbox_root, directory)
+ else:
+ utils.copy_files(sandbox_root, directory)
+ except OSError as e:
+ raise PipelineError("Failed to checkout files: {}".format(e)) from e
+ except BstError as e:
+ raise PipelineError("Error while staging dependencies into a sandbox: {}".format(e),
+ reason=e.reason) from e
# Helper function for checkout()
#