mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
PR feedbacks
- Move exceptions to exceptions.py - Raise `UpgradeFailure` in upgrader - Refine the try/catch for upgraders in swarm
This commit is contained in:
9
libp2p/protocol_muxer/exceptions.py
Normal file
9
libp2p/protocol_muxer/exceptions.py
Normal file
@ -0,0 +1,9 @@
|
||||
from libp2p.exceptions import BaseLibp2pError
|
||||
|
||||
|
||||
class MultiselectError(BaseLibp2pError):
|
||||
"""Raised when an error occurs in multiselect process"""
|
||||
|
||||
|
||||
class MultiselectClientError(BaseLibp2pError):
|
||||
"""Raised when an error occurs in protocol selection process"""
|
||||
@ -2,6 +2,7 @@ from typing import Dict, Tuple
|
||||
|
||||
from libp2p.typing import StreamHandlerFn, TProtocol
|
||||
|
||||
from .exceptions import MultiselectError
|
||||
from .multiselect_communicator_interface import IMultiselectCommunicator
|
||||
from .multiselect_muxer_interface import IMultiselectMuxer
|
||||
|
||||
@ -97,7 +98,3 @@ def validate_handshake(handshake_contents: str) -> bool:
|
||||
# TODO: Modify this when format used by go repo for messages
|
||||
# is added
|
||||
return handshake_contents == MULTISELECT_PROTOCOL_ID
|
||||
|
||||
|
||||
class MultiselectError(ValueError):
|
||||
"""Raised when an error occurs in multiselect process"""
|
||||
|
||||
@ -2,6 +2,7 @@ from typing import Sequence
|
||||
|
||||
from libp2p.typing import TProtocol
|
||||
|
||||
from .exceptions import MultiselectClientError
|
||||
from .multiselect_client_interface import IMultiselectClient
|
||||
from .multiselect_communicator_interface import IMultiselectCommunicator
|
||||
|
||||
@ -116,7 +117,3 @@ def validate_handshake(handshake_contents: str) -> bool:
|
||||
# TODO: Modify this when format used by go repo for messages
|
||||
# is added
|
||||
return handshake_contents == MULTISELECT_PROTOCOL_ID
|
||||
|
||||
|
||||
class MultiselectClientError(ValueError):
|
||||
"""Raised when an error occurs in protocol selection process"""
|
||||
|
||||
Reference in New Issue
Block a user