aboutsummaryrefslogtreecommitdiff
path: root/lux-js/source
diff options
context:
space:
mode:
Diffstat (limited to 'lux-js/source')
-rw-r--r--lux-js/source/program.lux14
1 files changed, 7 insertions, 7 deletions
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux
index 52e923892..43ced94d8 100644
--- a/lux-js/source/program.lux
+++ b/lux-js/source/program.lux
@@ -498,19 +498,19 @@
@.js
(as_is (def: (eval code)
- (-> Text (Maybe Any))
+ (-> Text (Try (Maybe Any)))
## Note: I have to call "eval" this way
## in order to avoid a quirk of calling eval in Node
## when the code is running under "use strict";.
- (let [return ("js apply" (function.identity ("js constant" "eval")) code)]
- (if ("js object null?" return)
- #.None
- (#.Some return))))
+ (try (let [return ("js apply" (function.identity ("js constant" "eval")) code)]
+ (if ("js object null?" return)
+ #.None
+ (#.Some return)))))
(def: (evaluate! alias input)
(-> Context _.Expression (Try Any))
(do try.monad
- [?output (ffi.try (..eval (_.code input)))]
+ [?output (..eval (_.code input))]
(case ?output
(#.Some output)
(wrap output)
@@ -521,7 +521,7 @@
(def: (execute! input)
(-> _.Statement (Try Any))
(do try.monad
- [?output (ffi.try (..eval (_.code input)))]
+ [?output (..eval (_.code input))]
(wrap [])))
(def: (define! context input)