2018-08-28 13:58:03 +00:00
|
|
|
|
|
|
|
You can use Starlette's `DebugMiddleware` to display simple error tracebacks in the browser.
|
|
|
|
|
|
|
|
```python
|
|
|
|
from starlette.debug import DebugMiddleware
|
|
|
|
|
|
|
|
|
|
|
|
class App:
|
|
|
|
def __init__(self, scope):
|
|
|
|
self.scope = scope
|
|
|
|
|
|
|
|
async def __call__(self, receive, send):
|
|
|
|
raise RuntimeError('Something went wrong')
|
|
|
|
|
|
|
|
|
|
|
|
app = DebugMiddleware(App)
|
|
|
|
```
|
2018-09-04 10:52:29 +00:00
|
|
|
|
|
|
|
For a mode complete handling of exception cases you may wish to use Starlette's
|
2018-09-05 12:45:39 +00:00
|
|
|
[`ExceptionMiddleware`](../exceptions/) class instead, which also includes
|
2018-09-04 10:52:29 +00:00
|
|
|
optional debug handling.
|