diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/_artifactcache.py | 18 | ||||
-rw-r--r-- | src/buildstream/_remote.py | 2 | ||||
-rw-r--r-- | src/buildstream/_sourcecache.py | 6 |
3 files changed, 15 insertions, 11 deletions
diff --git a/src/buildstream/_artifactcache.py b/src/buildstream/_artifactcache.py index 9cebeb1a3..c1e87b6dc 100644 --- a/src/buildstream/_artifactcache.py +++ b/src/buildstream/_artifactcache.py @@ -80,7 +80,7 @@ class ArtifactRemote(BaseRemote): "capabilities service. Please check remote configuration." ) # Else raise exception with details - raise RemoteError("Remote initialisation failed: {}".format(e.details())) + raise RemoteError("Remote initialisation failed with status {}: {}".format(e.code().name, e.details())) if not response.artifact_capabilities: raise RemoteError("Configured remote does not support artifact service") @@ -512,7 +512,9 @@ class ArtifactCache(BaseCache): return False except grpc.RpcError as e: if e.code() != grpc.StatusCode.RESOURCE_EXHAUSTED: - raise ArtifactError("Failed to push artifact blobs: {}".format(e.details())) + raise ArtifactError( + "Failed to push artifact blobs with status {}: {}".format(e.code().name, e.details()) + ) return False return True @@ -545,7 +547,9 @@ class ArtifactCache(BaseCache): remote.get_artifact(element.get_artifact_name(key=key)) except grpc.RpcError as e: if e.code() != grpc.StatusCode.NOT_FOUND: - raise ArtifactError("Error checking artifact cache: {}".format(e.details())) + raise ArtifactError( + "Error checking artifact cache with status {}: {}".format(e.code().name, e.details()) + ) else: return False @@ -554,7 +558,7 @@ class ArtifactCache(BaseCache): try: remote.update_artifact(element.get_artifact_name(key=key), artifact_proto) except grpc.RpcError as e: - raise ArtifactError("Failed to push artifact: {}".format(e.details())) + raise ArtifactError("Failed to push artifact with status {}: {}".format(e.code().name, e.details())) return True @@ -600,7 +604,7 @@ class ArtifactCache(BaseCache): self.cas.fetch_blobs(remote, digests) except grpc.RpcError as e: if e.code() != grpc.StatusCode.NOT_FOUND: - raise ArtifactError("Failed to pull artifact: {}".format(e.details())) + raise ArtifactError("Failed to pull artifact with status {}: {}".format(e.code().name, e.details())) return False return True @@ -628,7 +632,7 @@ class ArtifactCache(BaseCache): artifact = remote.get_artifact(artifact_name) except grpc.RpcError as e: if e.code() != grpc.StatusCode.NOT_FOUND: - raise ArtifactError("Failed to pull artifact: {}".format(e.details())) + raise ArtifactError("Failed to pull artifact with status {}: {}".format(e.code().name, e.details())) return None # Write the artifact proto to cache @@ -655,7 +659,7 @@ class ArtifactCache(BaseCache): remote.artifact_service.GetArtifact(request) except grpc.RpcError as e: if e.code() != grpc.StatusCode.NOT_FOUND: - raise ArtifactError("Error when querying: {}".format(e.details())) + raise ArtifactError("Error when querying with status {}: {}".format(e.code().name, e.details())) return False return True diff --git a/src/buildstream/_remote.py b/src/buildstream/_remote.py index d01b13b32..d8b8e68fe 100644 --- a/src/buildstream/_remote.py +++ b/src/buildstream/_remote.py @@ -226,7 +226,7 @@ class BaseRemote: self._check() except grpc.RpcError as e: # str(e) is too verbose for errors reported to the user - raise RemoteError(e.details()) + raise RemoteError("{}: {}".format(e.code().name, e.details())) finally: self.close() diff --git a/src/buildstream/_sourcecache.py b/src/buildstream/_sourcecache.py index 4533a2580..dcde0b426 100644 --- a/src/buildstream/_sourcecache.py +++ b/src/buildstream/_sourcecache.py @@ -67,7 +67,7 @@ class SourceRemote(BaseRemote): "Configured remote does not have the BuildStream " "capabilities service. Please check remote configuration." ) - raise RemoteError("Remote initialisation failed: {}".format(e.details())) + raise RemoteError("Remote initialisation failed with status {}: {}".format(e.code().name, e.details())) if not response.source_capabilities: raise RemoteError("Configured remote does not support source service") @@ -345,7 +345,7 @@ class SourceCache(BaseCache): except grpc.RpcError as e: if e.code() != grpc.StatusCode.NOT_FOUND: - raise SourceCacheError("Failed to pull source: {}".format(e.details())) + raise SourceCacheError("Failed to pull source with status {}: {}".format(e.code().name, e.details())) return None def _push_source(self, source_ref, remote): @@ -356,5 +356,5 @@ class SourceCache(BaseCache): except grpc.RpcError as e: if e.code() != grpc.StatusCode.RESOURCE_EXHAUSTED: - raise SourceCacheError("Failed to push source: {}".format(e.details())) + raise SourceCacheError("Failed to push source with status {}: {}".format(e.code().name, e.details())) return None |