starlette/docs/debug.md

22 lines
531 B
Markdown
Raw Normal View History

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)
```
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
optional debug handling.