summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-16 12:36:01 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-16 12:36:01 -0400
commit237c9393b135b40e07f97b00699fd6cf9b48dac4 (patch)
treee5b913873d3ffcd5abcc024dbc7d74e8d1c2aad2 /lib
parent9ac7c1a3cfcd247d5f6313b0e122049ec0b98fe5 (diff)
onError
Diffstat (limited to 'lib')
-rw-r--r--lib/js/urweb.js12
-rw-r--r--lib/ur/basis.urs5
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 5ff5b9fb..5cf159ad 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -250,6 +250,18 @@ function pf() {
whine("Pattern match failure");
}
+var errorHandlers = null;
+
+function onError(f) {
+ errorHandlers = cons(f, errorHandlers);
+}
+
+function er(s) {
+ for (var ls = errorHandlers; ls; ls = ls.next)
+ ls.data(s)(null);
+ throw s;
+}
+
// Remote calls
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index cfb80850..2633d48e 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -550,6 +550,7 @@ val td : other ::: {Unit} -> [other ~ [Body, Tr]] =>
(** Aborting *)
-val error : t ::: Type -> xml [Body] [] [] -> t
-
+val error : t ::: Type -> xbody -> t
+val onError : (xbody -> transaction unit) -> transaction unit
+(* Client-side only *)