about summary refs log tree commit diff stats
path: root/src/utils
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-06-28 04:07:22 +0200
committerbptato <nincsnevem662@gmail.com>2023-06-28 04:07:22 +0200
commit7e0d0d96e4b8143509ae7d118f9e3dfc1077c468 (patch)
tree89ac493b661256884c680f6213508f999b4a43f4 /src/utils
parentc1975f3cd58ef1c1e8e2105ad486619cea4ad23e (diff)
downloadchawan-7e0d0d96e4b8143509ae7d118f9e3dfc1077c468.tar.gz
Refactor fromJS body
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/opt.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/utils/opt.nim b/src/utils/opt.nim
index 15100c2e..bcc4c595 100644
--- a/src/utils/opt.nim
+++ b/src/utils/opt.nim
@@ -101,6 +101,9 @@ template `?`*[T, E](res: Result[T, E]): auto =
     when typeof(result) is Result[T, E]:
       return x
     elif typeof(result).errType is E:
-      return err(x.error)
+      when E is void:
+        return err()
+      else:
+        return err(x.error)
     else:
       return err()