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

about HandleTransportError for DataSource

$
0
0
version : SmartGWT Pro v9.0p_2013-07-11/Pro Deployment
browser : any

I am using a listgrid with rest DataSource, in my case, however, I need to handle some custom error message when the server side returns 500 error with json format error, for instance :

the http response code is 500

Code:

{"response": {"sequence":1376977562044,"status":-1,"type":"Exception","startRow":0,"endRow":1,"totalRows":1,"data":[{"message":"mmm","name":"RuntimeException","className":"java.lang.RuntimeException","stackTrace":"N/A"}],"meta":{}} }
currently, the RPCManager.setHandleTransportErrorCallback can
get these message through the httpResponseText parameter, this is an global handler but I want to handle the error per datasource

now the question is, there is no way I can do it, neither DataSource.setHandleErrorCallback nor DataSource.fetchData(record, Callback) can acquire the message. the dsResponse.getHttpResponseText just return null and data is something like "Transport error - HTTP code: 500 for URL: "

I tracked the code and found following code in ISC_DataBinding.js :


Code:

// note for "clientCustom" operations this method is fired directly from
        // processResponse() and rpcResponse / rpcRequest will be null
        if (rpcResponse != null && rpcRequest != null) {
            // make the httpResponseCode available on dsResponse - needed for REST implementations
            dsResponse.httpResponseCode = rpcResponse.httpResponseCode;
            // grab the transactionNum - needed for relogin via resubmitTransaction()
            dsResponse.transactionNum = rpcResponse.transactionNum;
            // place the clientContext on the response
            dsResponse.clientContext = rpcRequest.clientContext;
            dsResponse.httpHeaders = rpcResponse.httpHeaders;
        } else {
            dsResponse.clientContext = dsRequest.clientContext;
        }

it seems that the code just ignore the httpResponseText from rpcResponse.


any suggestion or help would be appreciated

Viewing all articles
Browse latest Browse all 4756

Trending Articles