diff options
author | bptato <nincsnevem662@gmail.com> | 2024-08-10 13:59:18 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-08-10 13:59:18 +0200 |
commit | eb69b5fec4b6d75e8b5d2a54d3a342d8c7a4f595 (patch) | |
tree | 58c93c791c9c5744bd80f435ff6d469d80b79422 /src/local | |
parent | 7a0c5f3c849804245d1f48da024ba4b6c0619cd1 (diff) | |
download | chawan-eb69b5fec4b6d75e8b5d2a54d3a342d8c7a4f595.tar.gz |
pager: fix incorrect error message in rewrite-url
It did not actually break rewrite-url, but was still annoying.
Diffstat (limited to 'src/local')
-rw-r--r-- | src/local/pager.nim | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/local/pager.nim b/src/local/pager.nim index f39174a9..592db0c6 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -1154,9 +1154,12 @@ proc applySiteconf(pager: Pager; url: var URL; charsetOverride: Charset; let fun = sc.rewrite_url.get var arg0 = ctx.toJS(url) let ret = JS_Call(ctx, fun, JS_UNDEFINED, 1, arg0.toJSValueArray()) - var nu: URL - if ctx.fromJS(ret, nu).isSome: - if nu != nil: + if not JS_IsException(ret): + # Warning: we must only print exceptions if the *call* returned one. + # Conversion may simply error out because the function didn't return a + # new URL, and that's fine. + var nu: URL + if ctx.fromJS(ret, nu).isSome and nu != nil: url = nu else: #TODO should writeException the message to console |