Mercurial > urweb
diff lib/js/urweb.js @ 726:6fc633d990e7
onError
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 16 Apr 2009 12:36:01 -0400 |
parents | a5d8b470d7ca |
children | 2197f0e24a9f |
line wrap: on
line diff
--- a/lib/js/urweb.js Thu Apr 16 12:07:21 2009 -0400 +++ b/lib/js/urweb.js Thu Apr 16 12:36:01 2009 -0400 @@ -250,6 +250,18 @@ 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