浏览代码

still trying to fix exception tests

Falko Schindler 2 年之前
父节点
当前提交
97e42096a3
共有 2 个文件被更改,包括 2 次插入1 次删除
  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',
     )