mirror of https://github.com/encode/starlette.git
531 B
531 B
You can use Starlette's DebugMiddleware
to display simple error tracebacks in the browser.
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 more complete handling of exception cases you may wish to use Starlette's
ExceptionMiddleware
class instead, which also includes
optional debug handling.