0

I'm having weird issues with GWT 2.4.0. I am sending a REST request, in its callback I am parsing a JSON document. Such parsing can throw a RuntimeException. While an exception is indeed thrown in the Development Mode, it doesn't propagate to a browser when running in the Production Mode (there's nothing in the Chrome Console).

Even if I reduce my code to the following, it still won't work in the Production Mode.

@Override
    public void onModuleLoad() {
        final RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, "some-json-url");
        try {
            requestBuilder.sendRequest(null, new JsonRequestCallback());
        } catch (final RequestException e) {
            throw new RuntimeException(e);
        }
    }

    private static class JsonRequestCallback implements RequestCallback {

        @Override
        public void onResponseReceived(final Request request, final Response response) {
            throw new RuntimeException("exception");
        }

        @Override
        public void onError(final Request request, final Throwable exception) {
            throw new RuntimeException(exception);
        }
    }
Mike Borozdin
  • 1,138
  • 3
  • 14
  • 32
  • I tought I had an answer, but if you get nothing in the Chrome Console, I must be wrong. Mysterious problem. – Julien Mar 04 '14 at 15:08
  • Try updating to a recent GWT version? (2.4 is more than 2 years old already!) – Thomas Broyer Mar 04 '14 at 16:00
  • 1
    Do you have an GWT.setUncaughtExceptionHandler() configured. If not you might try configuring one and see if you can catch the RuntimeException. This way you can be sure it is indeed being thrown correctly and maybe the browser is not handling it correctly. – Chris Hinshaw Mar 04 '14 at 18:05

0 Answers0