You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:46:25 UTC

[buildstream] 06/08: _stream.py: Added missing machine readable error codes

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/shell-artifacts
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 5c08f314f68fbb8c17c21ba49ead2f1fe53f3f8d
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Wed Dec 9 16:04:56 2020 +0900

    _stream.py: Added missing machine readable error codes
    
    In errors pertaining to failing to launch a shell with a buildtree.
---
 src/buildstream/_stream.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index a539156..a3e4ba5 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -221,6 +221,7 @@ class Stream:
             raise StreamError(
                 "Elements need to be built or downloaded before staging a shell environment",
                 detail="\n".join(list(map(lambda x: x._get_full_name(), missing_deps))),
+                reason="shell-missing-deps",
             )
 
         # Check if we require a pull queue attempt, with given artifact state and context
@@ -229,11 +230,14 @@ class Stream:
                 remotes_message = " or in available remotes" if pull_ else ""
                 if not element._cached():
                     message = "Artifact not cached locally" + remotes_message
+                    reason = "missing-buildtree-artifact-not-cached"
                 elif element._buildtree_exists():
                     message = "Buildtree is not cached locally" + remotes_message
+                    reason = "missing-buildtree-artifact-buildtree-not-cached"
                 else:
                     message = "Artifact was created without buildtree"
-                raise StreamError(message)
+                    reason = "missing-buildtree-artifact-created-without-buildtree"
+                raise StreamError(message, reason=reason)
 
             # Raise warning if the element is cached in a failed state
             if element._cached_failure():