1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    12
    Vote Rating
    0
    ashly.jos@gmail.com is on a distinguished road

      0  

    Default GWT-RPC How to invoke onFailure method from server side explicitly?

    GWT-RPC How to invoke onFailure method from server side explicitly?


    Hi,

    On an Async call (GWT-TPC), how can I invoke onFailure method from serverside explicitly?

    I need to handle few exception scenarios at the client side with respect to exceptions in the server side.

    please help...

    thanks in advance,
    -ash

  2. #2
    Sencha User
    Join Date
    Jun 2010
    Location
    Cajamarca, Peru
    Posts
    42
    Vote Rating
    0
    cimballi is on a distinguished road

      0  

    Default


    Only have your code throw an exception and the onFailure method will be called.

  3. #3
    Sencha User
    Join Date
    Apr 2011
    Posts
    12
    Vote Rating
    0
    ashly.jos@gmail.com is on a distinguished road

      0  

    Default


    thanks cimballi, I got that.

    But, how do I throw different type of exceptions? I need to show different messages for different type of exceptions.

    I have tried throwing different exceptions with different messages as:

    throw new StatusCodeException(1, "Error adding values");

    But when onFailure method is invoked, it receives Throwable object with description "There was some error on invoking service" (can't remember the exact description as I'm not in front of the program now).

    Is there any way to differentiate the errors at the client side?

    thanks,
    -ash

  4. #4
    Sencha User
    Join Date
    Jun 2010
    Location
    Cajamarca, Peru
    Posts
    42
    Vote Rating
    0
    cimballi is on a distinguished road

      0  

    Default


    That's because you did not specify these exceptions in the methods signature of the GWT service class. You can search for "gwt handling exceptions" in a search engine.

  5. #5
    Sencha User
    Join Date
    Oct 2010
    Posts
    129
    Vote Rating
    0
    blay is on a distinguished road

      0  

    Default


    Yep, just define your custom exception (it should extend IsSerializable class) and in the signature of the method in your service you have to declare that exception can be thrown.

    In the "onFailure" method you simply compare like:

    if (throwable instanceOf CustomException){
    ...
    }

Similar Threads

  1. Ext.ux.OnDemandLoad : Dynamic load js file and invoke the method in it
    By LoriSun in forum Ext 2.x: User Extensions and Plugins
    Replies: 19
    Last Post: 24 Oct 2011, 4:07 AM
  2. Replies: 3
    Last Post: 9 Jul 2010, 1:13 AM
  3. window closure impacts server side function invoke?
    By tkm in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 14 May 2008, 6:39 AM
  4. question about a panel invoke load method!
    By hysuper6 in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 21 Mar 2008, 1:39 PM
  5. setUrl() method to invoke java script Urgent!!!!! Plz Help..
    By redy in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 11 Mar 2007, 10:13 PM

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi