Describe the bug
FastAPI is incompatible with Startlette handling error. The error is that 'FastAPI' object has no attribute 'exception_handlers'.
Here the trace error:
File "/app/soarapi/app.py", line 72, in <module>
application = app = FastAPI()
File "/usr/local/lib/python3.7/site-packages/fastapi/applications.py", line 78, in __init__
self.setup()
File "/usr/local/lib/python3.7/site-packages/fastapi/applications.py", line 130, in setup
self.add_exception_handler(HTTPException, http_exception_handler)
File "/usr/local/lib/python3.7/site-packages/starlette/applications.py", line 124, in add_exception_handler
self.exception_handlers[exc_class_or_status_code] = handler
AttributeError: 'FastAPI' object has no attribute 'exception_handlers'
To Reproduce
Just run the tutorial to reproduce the error: docs/handling_errors/tutorial004.py
Expected behavior
I expected that the exception_handler interface worked similar as Starlette.
Screenshots
no
Environment:
I read about FastAPI deps and it compatible with Starlette 0.12.9.
Please reopen this issue as this issue persists with the latest version of starlette
Hi when is FastAPI planning to support the latest version of Starlette? I am getting errors for anything greater than 0.12.11
Thanks for reporting back and closing the issue @nielsonsantana :+1:
FastAPI supports Starlette 0.13.2 since version 0.50.0 (we're at version 0.54.1 now).
Most helpful comment
I read about FastAPI deps and it compatible with Starlette 0.12.9.