Commit graph

26 commits

Author SHA1 Message Date
belikor
65323b4169 file_manager: raise new InvalidStreamURLError if the URL is invalid
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/
```
2022-03-15 15:34:08 -03:00
Jack Robison
b4853c5f67 fix merge conflicts and simplify extract_doc 2022-03-15 15:34:08 -03:00
Victor Shyba
78b12dc411 fix conflict with imported function 2022-03-15 15:34:07 -03:00
Victor Shyba
27457db5c3 errors for empyt and misssing file on publish 2022-03-15 15:34:07 -03:00
Victor Shyba
e569fdd43c generalize stream empty to argument empty 2022-03-15 15:34:07 -03:00
Victor Shyba
00a850500d empty stream name error for user input 2022-03-15 15:34:07 -03:00
Victor Shyba
25aa2f95a5 error for missing channel private key 2022-03-15 15:34:07 -03:00
Victor Shyba
dc2ccc4fe8 error for already purchased claims 2022-03-15 15:34:07 -03:00
Victor Shyba
358ef4536f add ConflictingInputValueError for claim_id+claim_ids 2021-09-10 18:57:20 -03:00
Victor Shyba
40d26cb868 fix error msg to match Go msg 2021-09-10 18:57:20 -03:00
Lex Berezhny
dc1d9e1c84 upgrade pylint and fix lint errors 2021-08-20 22:36:35 -04:00
Jack Robison
25d54accf8
return api errors from wallet_add and wallet_create 2021-08-17 12:30:17 -04:00
Jack Robison
2445c00c7e
raise WalletNotLoadedError in get_wallet_or_error instead of ValueError 2021-08-17 11:30:58 -04:00
Victor Shyba
43989122bb add error type and message to error readme and update code 2021-08-09 15:07:44 -03:00
Victor Shyba
72712d6047 raise and disconnect if too many parameters are used on search 2021-08-09 15:07:44 -03:00
Victor Shyba
c5b939cfb7 fix tests 2021-07-22 16:25:55 -03:00
Victor Shyba
5bd411ca27 filtering hash->id 2021-07-22 16:25:55 -03:00
Lex Berezhny
c7d42f00c6 shorten error message for ServerPaymentFeeAboveMaxAllowed 2020-02-21 10:16:56 -05:00
Lex Berezhny
b1318a9958 minor cleanup 2020-02-21 10:05:46 -05:00
Victor Shyba
d2560d260c use stream controller and documented errors 2020-02-21 00:04:37 -03:00
Lex Berezhny
6fbbf36143 pylint 2020-02-07 18:44:30 -05:00
Lex Berezhny
db25f3282e lbry.error: save arguments on self and support for functions around arguments 2020-02-07 18:25:06 -05:00
Lex Berezhny
b7eec0586c added ResolveCensoredError 2020-02-01 12:49:01 -05:00
Jack Robison
1bf51e855d
check minimum server version from wallet client 2020-01-15 15:55:39 -05:00
Lex Berezhny
d27e8cf73a pylint fix in lbry/error/generate.py 2020-01-03 03:08:15 -05:00
Lex Berezhny
2968f74c6c moved lbry up one level 2020-01-01 15:57:56 -05:00