Merge pull request #1868 from lbryio/fix_error_response

format error dict on get
This commit is contained in:
Jack Robison 2019-02-06 10:37:31 -05:00 committed by GitHub
commit f8dc0f298e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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