1 Reply Latest reply on Sep 19, 2011 10:40 AM by Christian Sadilek

    Catching server-side exceptions on client side?

    slawek t Novice


      I'm using errai 1.3.0.CR1 and communication between client and server looks like this:


      client code


      (sending message)



                                              .with(MessageParts.ReplyTo, DEPENDENTNUMBERS_CLIENT)

                                              .with("selectedNumber", baseNumber).errorsHandledBy( new ErrorCallback( ) {


        (1)               public boolean error( Message message, Throwable throwable ) {

                              throwable.printStackTrace( );

                              return true;


                      } )




      server code


      (receiving message and sending response)


      public class DependentNumbersService implements MessageCallback {



          public void callback( Message message ) {

              throw new AuthenticationException("you are not logged in yet!");





      client code again


      (receiving message)

      erraiBus.subscribe(DEPENDENTNUMBERS_CLIENT, new MessageCallback() {


                                    public void callback(Message message) {

                                              dependentNumbers = message.get(List.class, "subnumbers");





      The problem is that I can't catch exception raised on server side (AuthenticationException).

      The method bookmarked in code as (1) is not handling the exception.


      I saw the example RPCdemo attached to errai-1.3.0.CR1.zip file and there is an example how to catch exceptions raised on server side, but it's for RPC calls only.


      How can I catch server-side exceptions with using errai messages?