Mercurial > urweb
changeset 1890:abb0e95dcaa1
Fix more of client-side error handlers
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 14 Nov 2013 06:36:36 -0500 |
parents | c40ed80be943 |
children | 779c390382b9 |
files | lib/js/urweb.js tests/updateErr.ur |
diffstat | 2 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/js/urweb.js Thu Nov 14 06:16:58 2013 -0500 +++ b/lib/js/urweb.js Thu Nov 14 06:36:36 2013 -0500 @@ -376,15 +376,19 @@ 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 @@ var failHandlers = null; function onFail(f) { - failHandlers = cons(f, failHandlers); + failHandlers = cons(flift0(f), failHandlers); } function doExn(v) { @@ -434,7 +438,7 @@ var serverHandlers = null; function onServerError(f) { - serverHandlers = cons(f, serverHandlers); + serverHandlers = cons(flift0(f), serverHandlers); } function servErr(s) {
--- a/tests/updateErr.ur Thu Nov 14 06:16:58 2013 -0500 +++ b/tests/updateErr.ur Thu Nov 14 06:36:36 2013 -0500 @@ -8,8 +8,9 @@ <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/>