empty stream name error for user input
This commit is contained in:
parent
25aa2f95a5
commit
00a850500d
3 changed files with 9 additions and 3 deletions
|
@ -25,6 +25,7 @@ Message | User friendly error message explaining the exceptional event. Supports
|
||||||
Code | Name | Message
|
Code | Name | Message
|
||||||
---:|---|---
|
---:|---|---
|
||||||
**1xx** | UserInput | User input errors.
|
**1xx** | UserInput | User input errors.
|
||||||
|
111 | EmptyStreamName | Stream name cannot be blank.
|
||||||
**10x** | Command | Errors preparing to execute commands.
|
**10x** | Command | Errors preparing to execute commands.
|
||||||
101 | CommandDoesNotExist | Command '{command}' does not exist.
|
101 | CommandDoesNotExist | Command '{command}' does not exist.
|
||||||
102 | CommandDeprecated | Command '{command}' is deprecated.
|
102 | CommandDeprecated | Command '{command}' is deprecated.
|
||||||
|
|
|
@ -7,6 +7,12 @@ class UserInputError(BaseError):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class EmptyStreamNameError(UserInputError):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("Stream name cannot be blank.")
|
||||||
|
|
||||||
|
|
||||||
class CommandError(UserInputError):
|
class CommandError(UserInputError):
|
||||||
"""
|
"""
|
||||||
Errors preparing to execute commands.
|
Errors preparing to execute commands.
|
||||||
|
|
|
@ -38,7 +38,7 @@ from lbry.dht.peer import make_kademlia_peer
|
||||||
from lbry.error import (
|
from lbry.error import (
|
||||||
DownloadSDTimeoutError, ComponentsNotStartedError, ComponentStartConditionNotMetError,
|
DownloadSDTimeoutError, ComponentsNotStartedError, ComponentStartConditionNotMetError,
|
||||||
CommandDoesNotExistError, BaseError, WalletNotFoundError, WalletAlreadyLoadedError, WalletAlreadyExistsError,
|
CommandDoesNotExistError, BaseError, WalletNotFoundError, WalletAlreadyLoadedError, WalletAlreadyExistsError,
|
||||||
ConflictingInputValueError, AlreadyPurchasedError, PrivateKeyNotFoundError
|
ConflictingInputValueError, AlreadyPurchasedError, PrivateKeyNotFoundError, EmptyStreamNameError
|
||||||
)
|
)
|
||||||
from lbry.extras import system_info
|
from lbry.extras import system_info
|
||||||
from lbry.extras.daemon import analytics
|
from lbry.extras.daemon import analytics
|
||||||
|
@ -5242,8 +5242,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
def valid_stream_name_or_error(name: str):
|
def valid_stream_name_or_error(name: str):
|
||||||
try:
|
try:
|
||||||
if not name:
|
if not name:
|
||||||
# TODO: use error from lbry.error
|
raise EmptyStreamNameError()
|
||||||
raise Exception('Stream name cannot be blank.')
|
|
||||||
parsed = URL.parse(name)
|
parsed = URL.parse(name)
|
||||||
if parsed.has_channel:
|
if parsed.has_channel:
|
||||||
# TODO: use error from lbry.error
|
# TODO: use error from lbry.error
|
||||||
|
|
Loading…
Reference in a new issue