quart icon indicating copy to clipboard operation
quart copied to clipboard

ConnectionAbortedError/asyncio.CancelledError when the page's loading is canceled by the user is not catchable.

Open ignpoppyseed opened this issue 2 years ago • 1 comments

The error ConnectionAbortedError is thrown if the page's loading is canceled. Using @app.errorhandler(ConnectionAbortedError) with an appropriate function is completely ignored. How do I handle (or just suppress) this error?

reproducible example:

from quart import Quart
from time import sleep
import asyncio

app = Quart(__name__)

@app.route('/')
async def hello():
    await asyncio.sleep(1)
    return 'Hello, world!'

if __name__ == '__main__':
    app.run()

reproduce the bug: run the script. connect to localhost:5000. cancel the load when the page is loading.

traceback: https://pastebin.com/aueksHyg

this error should not be thrown (or there needs to be a way to catch it.)

Environment:

  • Python version: 3.11.2
  • Quart version: 0.18.4

ignpoppyseed avatar Apr 17 '23 17:04 ignpoppyseed

not sure if it is the same issue with this one https://github.com/pallets/quart/issues/266

JerryHuang-LE avatar Sep 05 '23 06:09 JerryHuang-LE