mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-06 08:31:34 +08:00
#928 returned JSON for unhandled exceptions via @app.exception_handler (Exception). Starlette installs that on its outermost ServerErrorMiddleware, so the response skips every middleware registered in this module: the 500 carried no CORS headers — a cross-origin caller saw an opaque CORS failure instead of the JSON body, defeating the point — and never reached the selective access log either. Same body, same status, registered as a middleware ahead of CORSMiddleware so it sits inside it and the response travels back out through the normal stack. One boundary rather than an out-of-band second mechanism.