Skip to content

Commit

Permalink
async call print error
Browse files Browse the repository at this point in the history
  • Loading branch information
BSPR0002 committed Nov 11, 2024
1 parent 275b01b commit 803dca1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion webview/bridge.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from asyncio import get_event_loop, iscoroutine
from threading import Thread
from traceback import print_exception
import clr
from inspect import isbuiltin, isfunction, ismethod
from json import dumps, loads
Expand Down Expand Up @@ -35,9 +36,12 @@ def async_call_thread(function: Callable, args_json: str, async_object ):
if (iscoroutine(result)): result=get_event_loop().run_until_complete(result)
except BaseException as error:
async_object.SetResult("#" + dumps([error.__class__.__name__, str(error)], ensure_ascii=False))
print_exception(error)
return
try: async_object.SetResult(dumps(result, ensure_ascii=False, default=serialize_object))
except: async_object.SetResult("")
except BaseException as error:
async_object.SetResult("")
print_exception(error)

class Bridge:
def __init__(self, core, api: object):
Expand Down

0 comments on commit 803dca1

Please sign in to comment.