Duplicate WebSocketException
class in starlette and websockets
#2080
Unanswered
ukalwa
asked this question in
Potential Issue
Replies: 0 comments 12 replies
-
What uvicorn version are you using? |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
It looks like there is a websocket exception base class in both starlette and websockets. Should they be treated as separate. I ran into an issue where I am catching all websocket exceptions (including ConnectionClosedError) raised in a fastapi endpoint and using
startlette.exceptions.WebSocketException
didn't work. I had to usewebsockets.exceptions.WebSocketException
to catch them.Should I be using
websockets.exceptions
orstarlette.exceptions
? FastAPI exports starlette.exceptions but they don't seem to work in this case.Here is a simple contrived example:
Here is the stack trace:
To reproduce, the client connects to the socket and then disconnects.
Beta Was this translation helpful? Give feedback.
All reactions