Raise custom exception instead of RuntimeError
#2504
Unanswered
browniebroke
asked this question in
Ideas
Replies: 1 comment 3 replies
-
I don't understand how changing the exception would make it easier for you. 🤔 You're sending the |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We're using uvicorn with server side event in a Django application. We're sometimes getting some
RuntimeError
raised by uvicorn:Looking at the uvicorn code, it seems perfectly reasonable to raise something, so I was thinking to catch the appropriate exception and do something with it when that happens. However, we have a few framework layers between where the exception is raised by uvicorn and our code, so catching for plain
RuntimeError
seems a bit broad and I'm a bit concerned of hiding other issues.Would it make sense for uvicorn to define its own set of exception classes and raise them instead of raising built-in exceptions from the standard library? It would certainly make it easier for us to target and handle the right error.
Beta Was this translation helpful? Give feedback.
All reactions