Mercurial > urweb
changeset 2188:61866c765485
Better client-side error messages for RPC failures
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 01 Nov 2015 12:23:44 -0500 |
parents | 14c45a0b6362 |
children | 43393a4a66ce |
files | lib/js/urweb.js |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/js/urweb.js Sun Nov 01 11:55:01 2015 -0500 +++ b/lib/js/urweb.js Sun Nov 01 12:23:44 2015 -0500 @@ -472,8 +472,11 @@ connectHandlers = cons(flift(f), connectHandlers); } -function conn() { - runHandlers("Connect", connectHandlers, null); +function conn(msg) { + var rx = /(.*)<body>((.|\n|\r)*)<\/body>(.*)/g; + var arr = rx.exec(msg); + msg = (arr && arr.length >= 3) ? arr[2] : msg; + runHandlers("RPC failure", connectHandlers, msg); } var serverHandlers = null; @@ -1595,7 +1598,7 @@ } } else { if (isN == null) - conn(); + conn(xhr.responseText); else k(null); }