diff --git a/swh/objstorage/cloud/objstorage_azure.py b/swh/objstorage/cloud/objstorage_azure.py --- a/swh/objstorage/cloud/objstorage_azure.py +++ b/swh/objstorage/cloud/objstorage_azure.py @@ -101,7 +101,7 @@ container_name=self.container_name, blob_name=hex_obj_id) except AzureMissingResourceHttpError: - raise ObjNotFoundError('Content %s not found!' % hex_obj_id) + raise ObjNotFoundError(obj_id) return gzip.decompress(blob.content) diff --git a/swh/objstorage/cloud/objstorage_cloud.py b/swh/objstorage/cloud/objstorage_cloud.py --- a/swh/objstorage/cloud/objstorage_cloud.py +++ b/swh/objstorage/cloud/objstorage_cloud.py @@ -139,7 +139,7 @@ try: return self.driver.get_object(self.container_name, hex_obj_id) except ObjectDoesNotExistError as e: - raise ObjNotFoundError(e.object_name) + raise ObjNotFoundError(obj_id) def _put_object(self, content, obj_id): """Create an object in the cloud storage. diff --git a/swh/objstorage/tests/objstorage_testing.py b/swh/objstorage/tests/objstorage_testing.py --- a/swh/objstorage/tests/objstorage_testing.py +++ b/swh/objstorage/tests/objstorage_testing.py @@ -90,9 +90,11 @@ @istest def get_missing(self): content, obj_id = self.hash_content(b'get_missing') - with self.assertRaises(exc.Error): + with self.assertRaises(exc.ObjNotFoundError) as e: self.storage.get(obj_id) + self.assertIn(obj_id, e.exception.args) + @istest def check_missing(self): content, obj_id = self.hash_content(b'check_missing')