Skip to content

Commit

Permalink
catch JavaScriptException (and ignore if pywebview version < 5)
Browse files Browse the repository at this point in the history
  • Loading branch information
louisnw01 committed May 6, 2024
1 parent 07383e9 commit acdccc4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lightweight_charts/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
import multiprocessing as mp
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 .util import parse_event_message, FLOAT

Expand Down Expand Up @@ -61,8 +67,12 @@ def loop(self, loaded):
self.return_queue.put(self.windows[i].evaluate_js(arg[14:]))
else:
self.windows[i].evaluate_js(arg)
except KeyError:
except KeyError as e:
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):
Expand Down

0 comments on commit acdccc4

Please sign in to comment.