summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/js/urweb.js12
-rw-r--r--tests/updateErr.ur3
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 6315567e..59708150 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -376,15 +376,19 @@ function runHandlers(kind, ls, arg) {
alert(kind + ": " + arg);
for (; ls; ls = ls.next)
try {
- exec({c:"a", f:{c:"a", f:{c:"c", v:ls.data}, x:{c:"c", v:arg}}, x:{c:"c", v:null}});
+ exec({c:"a", f:{c:"a", f:ls.data, x:{c:"c", v:arg}}, x:{c:"c", v:null}});
} catch (v) { }
}
}
var errorHandlers = null;
+function flift0(v) {
+ return {c:"c", v:v};
+}
+
function onError(f) {
- errorHandlers = cons(f, errorHandlers);
+ errorHandlers = cons(flift0(f), errorHandlers);
}
function er(s) {
@@ -395,7 +399,7 @@ function er(s) {
var failHandlers = null;
function onFail(f) {
- failHandlers = cons(f, failHandlers);
+ failHandlers = cons(flift0(f), failHandlers);
}
function doExn(v) {
@@ -434,7 +438,7 @@ function conn() {
var serverHandlers = null;
function onServerError(f) {
- serverHandlers = cons(f, serverHandlers);
+ serverHandlers = cons(flift0(f), serverHandlers);
}
function servErr(s) {
diff --git a/tests/updateErr.ur b/tests/updateErr.ur
index 345e3aa8..d15f27a0 100644
--- a/tests/updateErr.ur
+++ b/tests/updateErr.ur
@@ -8,8 +8,9 @@ fun main () : transaction page =
<dyn signal={s <- signal s; return <xml>{[s]}</xml>}/><br/>
<dyn signal={s <- signal s; if s = "" then return <xml>Init</xml> else error <xml>Crapky</xml>}/><br/>
<dyn signal={s <- signal s; return <xml>"{[s]}"</xml>}/><br/>
+ <button onclick={fn _ => debug "88"}/><br/>
- <ctextbox source={txt}/> <button onclick={s' <- get txt; set s s'; set txt ""}/>
+ <ctextbox source={txt}/> <button onclick={fn _ => s' <- get txt; set s s'; set txt ""}/>
<hr/>