diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-17 00:36:25 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-17 00:36:25 +0000 |
commit | d87b7a5e7430ab946c851208e45ddbf03330c98f (patch) | |
tree | a25d04d5dd5ba93de5b138164bb63a4528f07565 /java/sca/tutorial/store-mashup | |
parent | 3f56676b3bf9248726941f88018bf7b38db5e895 (diff) |
TUSCANY-1961 - Properly reporting business and runtime exceptions to clients using jsonRPC binding
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@677479 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/tutorial/store-mashup')
-rw-r--r-- | java/sca/tutorial/store-mashup/gadget/store-gadget.html | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/java/sca/tutorial/store-mashup/gadget/store-gadget.html b/java/sca/tutorial/store-mashup/gadget/store-gadget.html index c2a8ba5118..c09b9d28c8 100644 --- a/java/sca/tutorial/store-mashup/gadget/store-gadget.html +++ b/java/sca/tutorial/store-mashup/gadget/store-gadget.html @@ -35,7 +35,11 @@ var catalogItems; - function catalog_getResponse(items) { + function catalog_getResponse(items,exception) { + if(exception){ + alert(exception.message); + return; + } var catalog = ""; for (var i=0; i<items.length; i++) { var item = items[i].name + ' - ' + items[i].price; @@ -58,13 +62,22 @@ } document.getElementById("shoppingCart").innerHTML = list; - if (entries.length != 0) { - shoppingTotal.getTotal(shoppingTotal_getTotalResponse); + if (entries.length != 0) { + try { + shoppingTotal.getTotal(shoppingTotal_getTotalResponse); + } + carch(e) { + alert(e); + } } } } - function shoppingTotal_getTotalResponse(total) { + function shoppingTotal_getTotalResponse(total,exception) { + if(exception){ + alert(exception.message); + return; + } document.getElementById('total').innerHTML = total; } @@ -113,8 +126,13 @@ } function init() { - catalog.get(catalog_getResponse); - shoppingCart.get("", shoppingCart_getResponse); + try { + catalog.get(catalog_getResponse); + shoppingCart.get("", shoppingCart_getResponse); + } + catch(e) { + alert(e); + } } </script> |