From b1e2a9ce0c996de83b161a21d4e6ebb188a74699 Mon Sep 17 00:00:00 2001 From: bptato Date: Sat, 24 Feb 2024 03:55:48 +0100 Subject: dom: print parse errors to console instead of trying to evaluate exceptions... --- src/html/dom.nim | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/html') 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: -- cgit