Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RequestFactory: error.getExceptionType() returns null in Receiver#onFailure

In the server side i have:

public void throwException() throws Exception {
        throw new NullPointerException("fslkdjflks");
}

in the client side i have:

_requestFactory.myService().throwException().fire(new Receiver<Void>() {

            @Override
            public void onSuccess(Void response) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onFailure(ServerFailure error) {
                // TODO Auto-generated method stub
                Window.alert(error.getExceptionType() + " " + error.getMessage());

            }

        });

error.getExceptionType() returns null and not the type of the exception. Any idea why?

Thanks, Gilad.

like image 355
Gilad Avatar asked Jul 20 '26 16:07

Gilad


2 Answers

The default ExceptionHandler (DefaultExeptionHandler) does not populate the exceptionType and stackTraceString. If you want them, you have to provide your own ExceptionHandler by extending RequestFactoryServlet.

like image 102
Thomas Broyer Avatar answered Jul 25 '26 18:07

Thomas Broyer


Addition to Thomas post, a link how to implement it.

Implement this and you get your StackTrace and find the Problem: http://cleancodematters.com/2011/05/29/improved-exceptionhandling-with-gwts-requestfactory/

Takes five minutues and saves you much time now and in future.

like image 38
Sam Avatar answered Jul 25 '26 18:07

Sam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!