No obvious way to handle asyncio.CancelledError
#1985
-
Hi there, In our project we had to deal with the following scenario:
What we did was adding custom middleware (the most outer one) catching all The much better one would be adding custom exception handler for asyncio.CancelledError is a BaseException .
Where there any reasons for that? Not handling (If I chose wrong category, please change it) Thanks and keep on with your great work! 💪 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
How do you have 6 upvotes? 🤔 What do you mean the "service was order to reload"? Are you using Ideally, the user of |
Beta Was this translation helpful? Give feedback.
-
I think there are cases in which user has to deal with cancellation errors:
Now, stopping the server while long request is in progress generates a nasty traceback:
IMO, making it possible to define a custom response for |
Beta Was this translation helpful? Give feedback.
How do you have 6 upvotes? 🤔
What do you mean the "service was order to reload"? Are you using
--reload
in production? 🤔Ideally, the user of
starlette
shouldn't need to worry aboutCancelledError
.