1 Reply Latest reply on Aug 1, 2014 4:32 PM by Max Barkley

    I Need Help With This Errai Demo Code ?

    Charles Odili Apprentice

      I am trying to figure out how to catch server errors on the client from a Caller<T> call. I have looked at the errai-jpa-demo-todo-list code on github, especialy where / how RegistrationException was used in SignupPage.java.

       

      I need some help understanding (I don't want to guess) what's going on between lines 92 and lines 103, but especially line 102 here http://goo.gl/0iQLhT

      Thanks.

        • 1. Re: I Need Help With This Errai Demo Code ?
          Max Barkley Expert

          Hi Charles,

           

          Let me try and break the error callback down for you:

          • The SignupService is annotated with @Remote, so it uses Errai Bus. Consequently, it needs a BusErrorCallback.
          • The error method of the BusErrorCallback is where your error handling goes. In this example, a Label on the page has an error message added to it and then is made visible.
          • The error method returns false because we do not want this error to propogate to the global uncaught exception handlers.
          • The whole RPC call is in a try/catch block because the SignupService.register method throws a checked exception (RegistrationException).
          • But, the checked exception will never be caught at line 102 because line 100 is invoking an RPCStub that triggers an asynchronous call. That's why all your error logic goes in the error callback.

           

          I hope that's cleared things up.