format error dict on get

This commit is contained in:
Victor Shyba 2019-02-06 11:46:49 -03:00
parent 1314f75219
commit 8b5803c945

View file

@ -1571,12 +1571,16 @@ class Daemon(metaclass=JSONRPCServerType):
} }
""" """
try:
stream = await self.stream_manager.download_stream_from_uri( stream = await self.stream_manager.download_stream_from_uri(
uri, self.exchange_rate_manager, file_name, timeout uri, self.exchange_rate_manager, file_name, timeout
) )
if stream: if not stream:
return stream.as_dict()
raise DownloadSDTimeout(uri) raise DownloadSDTimeout(uri)
except Exception as e:
return {"error": str(e)}
else:
return stream.as_dict()
@requires(STREAM_MANAGER_COMPONENT) @requires(STREAM_MANAGER_COMPONENT)
async def jsonrpc_file_set_status(self, status, **kwargs): async def jsonrpc_file_set_status(self, status, **kwargs):