FastAPI - Error Handling
Identify the error in this middleware code snippet:
```python
@app.middleware('http')
async def error_middleware(request: Request, call_next):
try:
response = call_next(request)
return response
except Exception as e:
return JSONResponse({'detail': str(e)}, status_code=500)
```
