Feature: make `HTTPException` non-abstract
- Vorherrschende Sprache
- Python
- Sterne
- 16.5k
- Forks
- 2.4k
- Ø Merge
- 20 Std. 10 Min.
- Gemergte PRs (30 T.)
- 221
Beschreibung
## Long story short
Use-case: a server's handler uses a client to make a request to another server. I would like to re-use the response status code in the first server's response (the code below does not work as `HTTPException`'s constructor does not accept parameter `status_code`):
```
try:
...
except ClientResponseError as e:
status = e.status or 500
raise web.HTTPException(text=e.message, status_code=status)
```
Of course I can use `return web.Response(text=e.message, status=status)`, but `web.Response` cannot be throwed, however I need it in my applicatoin.
## Expected behaviour
I would expect `web.HTTPException` not to be abstract so that one can construct and raise it with a dynamic status code.
## Actual behaviour
one cannot create an instance of `web.HTTPException`
## Steps to reproduce
(not a bug so no steps to reproduce)
## Your environment
(not a bug so no environment description)
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.