Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Custome error handling

$
0
0
Hi,

I was following the suggestion of this page

http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/docs/ErrorHandling.html

I need to have custom error handling of our DSRequest calls. But somehow it does not work. The code for custom error handling in the callback class was not called. Instead, there was a pop-up box for the error (I think that came from the default handling of SmartGWT)

My client code:

Code:

DSRequest properties = new DSRequest();
properties.setWillHandleError(true);
ds.performCustomOperation(
        "rGenQuery"
        , new Record()
        , dsCallback
        , properties
        );

Our callback class was defined like this

Code:

DSCallback dsCallback = new DSCallback() {
    public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) {
        int respStatus = dsResponse.getStatus();
        if (respStatus>0) {
            // ... normal processing
        } else if (respStatus==-400) {
            // custome handling of error -- but was not invoked when error occurred
        }

    }
};

The server signals this error condition by using DSResponse.setStatus() with a code of -400. Something like

Code:

return (new DSResponse().setStatus(-400));
The webpage above cited an exception case for transport error (that handleTransportError() will always be called). Would the status code of my choice (-400) be interpreted as a transport error? But I also tried -101 and the result was the same.

Viewing all articles
Browse latest Browse all 4756

Trending Articles