Dhaval Chauhan wrote:
Hi,

I was working on the scenarios for the JSON-RPC mentioned on the SCA
Java Web 2.0 Road map. I tried the first scenario i.e. 'Empty catalog
throws a Business Exception. Business Exception should properly
propagate and display nicely to client'

I tried simulating the exception condition by making the .get() method
of the FruitsCatalogImpl.java throw the business exception.

First I noticed that the JSON representation of the exception is not
being recognized by the browser js engine.
Currently, the Tuscany runtime is producing something like :

 "{\"id\":3,\"error\":services.ClientException: Fruits Catalog empty}"

Instead, I think it should be :
"{\"id\":3,\"error\":{\"trace\":\"services.ClientException: Fruits
Catalog empty\",\"code\":490,\"msg\":\"Fruits catalog empty\"}}"

Is it some issue related with the binding where the actual JSON error
message is formatted ?


After fixing this issue, I was still having issues with the exception
not being caught by the try/catch block, and I had to modify the
store.html client code as follow :

function init() {
           var item = new Array();
           try
           {
               item = catalog.get();
           }
           catch(e)
           {
               alert(e.message);
               return;
           }
           catalog_getResponse(item);
           shoppingCart.get("", shoppingCart_getResponse);
       }


Thanks,
Dhaval


This is a known issue, which needs to be looked at end-to-end and fixed, as described in JIRA https://issues.apache.org/jira/browse/TUSCANY-2394.

--
Jean-Sebastien

Reply via email to