Browse Source

add 404 error page

Falko Schindler 2 năm trước cách đây
mục cha
commit
8178e9e144
1 tập tin đã thay đổi với 5 bổ sung0 xóa
  1. 5 0
      nicegui/nicegui.py

+ 5 - 0
nicegui/nicegui.py

@@ -60,6 +60,11 @@ def shutdown() -> None:
     globals.state = globals.State.STOPPED
 
 
+@app.exception_handler(404)
+async def exception_handler(_: Request, exc: Exception):
+    return error_client.build_response(404, str(exc))
+
+
 @app.exception_handler(Exception)
 async def exception_handler(_: Request, exc: Exception):
     return error_client.build_response(500, str(exc))