Friday, December 9, 2016

Re: Got UmbrellaException when trying to show loading screen on async login processing using MaterialLoading

Check your server logs and put breakpoint there to see if it is reaching server, maybe your RPC is failing on the server.
Also take a look at the browser console, there might be a NPE before even calling the RPC.

Also, giving a look at your code, instead of manually showing and closing the loading dialog with every RPC call, you can wrap your calls in a generic class; which would override onSuccess and onFailure, and would take care of showing/hiding the loading indicator for you.


On Friday, December 9, 2016 at 8:34:40 AM UTC-5, Olar Andrei wrote:
Hello,

I have a little problem here, which I try to figure out why it is happening.

I use GWT Material Design in my project, and I just wanted to show a loading screen while the login is being processed, but I get an UmbrellaException, and the loading icon just spins there forever...

If I just remove MaterialLoader.showLoading(true); and MaterialLoader.showLoading(false); everything works.

Does anybody know why this is happening ?



private static void performUserConnection(String username, String password) {
    MaterialLoader.showLoading(true);

    DBConnectionAsync rpcService = (DBConnectionAsync) GWT.create(DBConnection.class);
    ServiceDefTarget target = (ServiceDefTarget) rpcService;
    String moduleRelativeURL = GWT.getModuleBaseURL() + "DBConnectionImpl";
    target.setServiceEntryPoint(moduleRelativeURL);

    rpcService.authenticateUser(username, password, new AsyncCallback<User>() {

        @Override
        public void onSuccess(User user) {
            MaterialLoader.showLoading(false); // Does not get here

            // ...

            if (user.getType().equals("User")) {
                presenter.goTo(new UserPlace(username));
            } else if (user.getType().equals("Admin")) {
                presenter.goTo(new AdminPlace(username));
            }
        }

        @Override
        public void onFailure(Throwable caught) {
            MaterialLoader.showLoading(false); // Does not get here

            if (caught instanceof InvalidCredentialsException) {
                MaterialToast.fireToast(caught.getMessage(), "rounded");
            } else {
                MaterialModal materialModal = ModalCreator.createModal("Something went wrong", caught);
                RootPanel.get().add(materialModal);
                materialModal.open();
            }

        }

    });
}

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment