aboutsummaryrefslogtreecommitdiffstats
path: root/src/html
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-02-24 03:55:48 +0100
committerbptato <nincsnevem662@gmail.com>2024-02-24 03:55:48 +0100
commitb1e2a9ce0c996de83b161a21d4e6ebb188a74699 (patch)
tree0b351dfaa41b81e94a8fe4a79174d5bac422da53 /src/html
parent2d038b2158ff59dc79f7eb741468fdced1fa4759 (diff)
downloadchawan-b1e2a9ce0c996de83b161a21d4e6ebb188a74699.tar.gz
dom: print parse errors to console
instead of trying to evaluate exceptions...
Diffstat (limited to 'src/html')
-rw-r--r--src/html/dom.nim15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim
index 2fa50e3b..e4325b18 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -3533,13 +3533,14 @@ proc execute*(element: HTMLScriptElement) =
if window != nil and window.jsctx != nil:
let script = element.scriptResult.script
let urls = script.baseURL.serialize(excludepassword = true)
- let ret = window.jsctx.evalFunction(script.record)
- if JS_IsException(ret):
- let ss = newStringStream()
- document.window.jsctx.writeException(ss)
- ss.setPosition(0)
- document.window.console.log("Exception in document", urls,
- ss.readAll())
+ if JS_IsException(script.record):
+ let s = document.window.jsctx.getExceptionStr()
+ document.window.console.log("Exception in document", urls, s)
+ else:
+ let ret = window.jsctx.evalFunction(script.record)
+ if JS_IsException(ret):
+ let s = document.window.jsctx.getExceptionStr()
+ document.window.console.log("Exception in document", urls, s)
document.currentScript = oldCurrentScript
else: discard #TODO
if needsInc: