Exception handlers registration behavior
See original GitHub issueShould Starlette
raise an exception when there are exception handlers for 500
status code and for Exception
class?
For instance, in this case, only one of those handlers will be called.
def handler_for_500(req, exc):
...
def handler_for_exception(req, exc):
...
app = Starlette(
exception_handlers={
500: handler_for_500,
Exception: handler_for_exception,
}
)
So my question - is this expected behavior or it is a bug?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Chapter 20: Exception Handling Frameworks - Micro Focus
An exception method enables you to handle an error raised by an Object COBOL object in the way that best suits the application....
Read more >Complete Guide to Exception Handling in Spring Boot
This article showcases various ways to handle exceptions in a Spring Boot Application.
Read more >Customizing exception handlers - IBM
User-written exception handlers permit you to customize exception handling for certain conditions. You can register a user-written exception handler for the ...
Read more >Exception Handling in Spring MVC
If the same exception can be handed in more than one way, you may not get the behavior you wanted.
Read more >Exception handling - Wikipedia
In computing and computer programming, exception handling is the process of responding to the occurrence of exceptions – anomalous or exceptional conditions ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry I didn’t explain that clearly. What I meant is that we could consider a full stop with a
RuntimeError
, or have a warning saying already have anerror_handler
and ignore it.Totally agree, let’s wait for feedback.
That’s just transferring the problem.
I don’t think we do any sacrifice doing the check, as we’ll run it once, but… Is it necessary?
Well, it’s been a year, let’s ask the issuer. @uriyyo after more than a year, what are your thoughts about this issue? Do you think doing the check is still necessary?