65323b4169
When using `lbrynet get URL`, if the URL is not a valid URL the function `url.URL.parse` will raise a `ValueError` exception which will produce a whole backtrace. For example, this is the case if we provide a channel name with a forward slash but without a stream name. ``` lbrynet get @Non-existing/ ``` ``` Traceback (most recent call last): File "/opt/git/lbry-sdk/lbry/file/file_manager.py", line 84, in download_from_uri if not URL.parse(uri).has_stream: File "/opt/git/lbry-sdk/lbry/schema/url.py", line 114, in parse raise ValueError('Invalid LBRY URL') ValueError: Invalid LBRY URL WARNING lbry.extras.daemon.daemon:1110: Error downloading Non-existing/: Invalid LBRY URL ``` Now we raise a new `InvalidStreamURLError` which can be trapped in the upper functions that use `url.URL.parse` such as `FileManager.download_from_uri`. If we do this the traceback won't be shown. ``` WARNING lbry.file.file_manager:252: Failed to download Non-existing/: Invalid LBRY stream URL: '@Non-existing/' WARNING lbry.extras.daemon.daemon:1110: Error downloading Non-existing/: Invalid LBRY stream URL: '@Non-existing/' ``` This handles the case when trying to download only "channel" parts without the claim part. ``` lbrynet get @Non-existing lbrynet get @Non-existing/ lbrynet get Non-existing/ ``` |
||
---|---|---|
.. | ||
__init__.py | ||
file_manager.py | ||
source.py | ||
source_manager.py |