Skip to content

Commit 57d66f0

Browse files
committed
Move WebSocketProtocolError to the legacy package.
This ensures that it will be deprecated and removed.
1 parent 3084a3b commit 57d66f0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/websockets/exceptions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,16 +404,16 @@ class ProtocolError(WebSocketException):
404404
"""
405405

406406

407-
WebSocketProtocolError = ProtocolError # for backwards compatibility
408-
409-
410407
# When type checking, import non-deprecated aliases eagerly. Else, import on demand.
411408
if typing.TYPE_CHECKING:
412409
from .legacy.exceptions import InvalidMessage
410+
411+
WebSocketProtocolError = ProtocolError
413412
else:
414413
lazy_import(
415414
globals(),
416415
aliases={
417416
"InvalidMessage": ".legacy.exceptions",
417+
"WebSocketProtocolError": ".legacy.exceptions",
418418
},
419419
)

src/websockets/legacy/exceptions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from ..exceptions import InvalidHandshake
1+
from ..exceptions import (
2+
InvalidHandshake,
3+
ProtocolError as WebSocketProtocolError, # noqa: F401
4+
)
25

36

47
class InvalidMessage(InvalidHandshake):

0 commit comments

Comments
 (0)