raise proper error when sd is not available

This commit is contained in:
Victor Shyba 2019-04-18 21:56:31 -03:00 committed by Jack Robison
parent 8107e97304
commit 9ba6653475
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -162,6 +162,8 @@ class StreamDescriptor:
@classmethod @classmethod
async def from_stream_descriptor_blob(cls, loop: asyncio.BaseEventLoop, blob_dir: str, async def from_stream_descriptor_blob(cls, loop: asyncio.BaseEventLoop, blob_dir: str,
blob: AbstractBlob) -> 'StreamDescriptor': blob: AbstractBlob) -> 'StreamDescriptor':
if not blob.is_readable():
raise InvalidStreamDescriptorError(f"unreadable/missing blob: {blob.blob_hash}")
return await loop.run_in_executor(None, cls._from_stream_descriptor_blob, loop, blob_dir, blob) return await loop.run_in_executor(None, cls._from_stream_descriptor_blob, loop, blob_dir, blob)
@staticmethod @staticmethod