Browse Source

still trying to fix exception tests

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

+ 1 - 0
nicegui/nicegui.py

@@ -73,6 +73,7 @@ async def exception_handler(request: Request, exception: Exception):
 
 @app.exception_handler(Exception)
 async def exception_handler(request: Request, exception: Exception):
+    globals.log.exception(exception)
     with Client(page('')) as client:
         error_content(500, exception)
     return client.build_response(request, 500)

+ 1 - 1
tests/test_page.py

@@ -142,7 +142,7 @@ def test_exception(screen: Screen):
     screen.should_contain('500')
     screen.should_contain('Server error')
     screen.assert_py_logger(
-        f'ERROR: unexpected exception for http://localhost:{PORT}/',
+        'ERROR: some exception',
         'ERROR: Exception in ASGI application',
     )