Jelajahi Sumber

fix bug when button callback exception

wangweimin 5 tahun lalu
induk
melakukan
4f1e800425
1 mengubah file dengan 4 tambahan dan 1 penghapusan
  1. 4 1
      pywebio/output_ctl.py

+ 4 - 1
pywebio/output_ctl.py

@@ -25,7 +25,10 @@ def register_callback(callback, save, mutex_mode):
             elif inspect.isgeneratorfunction(callback):
                 coro = asyncio.coroutine(callback)(save, event['data'])
             else:
-                callback(event['data'], save)
+                try:
+                    callback(event['data'], save)
+                except:
+                    Global.active_ws.on_coro_error()
 
             if coro is not None:
                 if mutex_mode: