summaryrefslogtreecommitdiff
path: root/lib/js
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
commit51e34115de1d243904e9b49c3839fde9c91c96c9 (patch)
treee5b913873d3ffcd5abcc024dbc7d74e8d1c2aad2 /lib/js
parent949880b71b6b3d105ff5d73b1cf6958509b85c1e (diff)
onError
Diffstat (limited to 'lib/js')
-rw-r--r--lib/js/urweb.js12
1 files changed, 12 insertions, 0 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