Skip to content

Implement catchable WebsocketClosed #2261

Open
@ahopkins

Description

@ahopkins

See #2220

In v21.9, a new WebsocketClosed exception was added.

While you can to do the following:

@app.websocker("/")
async def handler(request, ws):
    try:
        ...
    except asyncio.CancelledError:
        print("connection closed")

We would like to add support for this pattern:

@app.websocker("/")
async def handler(request, ws):
    try:
        ...
    except sanic.exceptions.WebsocketClosed:
        print("connection closed")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions