about summary refs log tree commit diff stats
path: root/src/js/javascript.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/javascript.nim')
-rw-r--r--src/js/javascript.nim10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim
index d7ccc115..bf81a09d 100644
--- a/src/js/javascript.nim
+++ b/src/js/javascript.nim
@@ -1240,9 +1240,13 @@ proc rewriteExceptions(gen: var JSFuncGenerator, errors: var seq[string], node:
     if c.kind == nnkCommand and c[0].eqIdent ident("JS_ERR"):
       if gen.copied == nil:
         gen.copied = copy(gen.original)
-      node[i] = quote do:
-        zeroMem(addr result, sizeof(result))
-        return
+      if gen.returnType.isSome:
+        node[i] = quote do:
+          zeroMem(addr result, sizeof(result))
+          return
+      else:
+        node[i] = quote do:
+          return
       if c[1].strVal notin errors:
         errors.add(c[1].strVal)
     elif c.len > 0: