catch JavaScriptException (and ignore if pywebview version < 5)
This commit is contained in:
@ -2,6 +2,12 @@ import asyncio
|
|||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
import webview
|
import webview
|
||||||
|
|
||||||
|
# temporary until we fix to pywebview v5
|
||||||
|
try:
|
||||||
|
from webview.errors import JavascriptException
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
JavascriptException = Exception
|
||||||
|
|
||||||
from lightweight_charts import abstract
|
from lightweight_charts import abstract
|
||||||
from .util import parse_event_message, FLOAT
|
from .util import parse_event_message, FLOAT
|
||||||
|
|
||||||
@ -61,8 +67,12 @@ class PyWV:
|
|||||||
self.return_queue.put(self.windows[i].evaluate_js(arg[14:]))
|
self.return_queue.put(self.windows[i].evaluate_js(arg[14:]))
|
||||||
else:
|
else:
|
||||||
self.windows[i].evaluate_js(arg)
|
self.windows[i].evaluate_js(arg)
|
||||||
except KeyError:
|
except KeyError as e:
|
||||||
return
|
return
|
||||||
|
except JavascriptException as e:
|
||||||
|
pass
|
||||||
|
# msg = eval(str(e))
|
||||||
|
# raise JavascriptException(f"\n\nscript -> '{arg}',\nerror -> {msg['name']}[{msg['line']}:{msg['column']}]\n{msg['message']}")
|
||||||
|
|
||||||
|
|
||||||
class Chart(abstract.AbstractChart):
|
class Chart(abstract.AbstractChart):
|
||||||
|
|||||||
Reference in New Issue
Block a user