Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    cannot cancel error to DSCallback

    Sorry my poor english

    SmartClient Version: SC_SNAPSHOT-2011-01-05/Pro Deployment (built 2011-01-05)

    Brower:Chromev23/IE9

    I setting the RPCManager.setHandleErrorCallback,and setting the custom error code,hope it can trigger all error,and the DsCallback() in business code not been call when the ErrorCallback been trigger.
    so i needn't do any error logic in business code

    when return response's status < 0,i can trigger the error,i can do any operation.
    but,after it return, the DSCallback() still been call.

    i try call RPCManager.clearTransaction(tranID) or
    RPCManager.cancelQueue() in ErrorCallback,

    i try to return the transition id in custom response,all of code no exception,
    but,the business callback still been call.

    i sure not setting the dsRequest.willhandlerError,in face,i not setting any custom DsRequest.

    about transactionID:
    if i call RPCManager.getCurrentTransactionId() it throw a exception
    "INFO: (TypeError): Cannot call method 'toString' of null "

    so i try to get tranID from RPCManager.getTransactionNum(request)
    and return the id with DSResponse
    but it prompt "11:30:05.205:XRP2:WARN:RPCManager:clearTransaction: no such transaction: 8"
    even i can see the same code in request header

    ===================================
    the business code:
    Code:
    	DSCallback cb=new DSCallback(){
    
    			@Override
    			public void execute(DSResponse response, Object rawData,
    					DSRequest request) {
                                    //i hope this code only execute at success       
    				log.info("still execute,after globe error oper.");
    			}
    			
    		};
                    
    	userGroupListgrid.fetchData(null,cb);
    the ErrorCallback code
    Code:
    RPCManager.setHandleErrorCallback(new HandleErrorCallback(){
    
    			@Override
    			public void handleError(DSResponse response, DSRequest request) {
    				log.info("globe error handler"+response.getStatus());
    				
    				if(response.getStatus()==MY_CUSTOM_ERROR_CODE){
    					log.info("error!");					
    				}
                                    //i try to response from service,but smartgwt prompt the id is invalid.
                                    //if i call RPCManager.getTransactionID(),then exception throw.
    
    				String tranID=response.getAttribute("tranID");				
    				log.info("finish globe error handler:"+tranID);
    
                                     //the line will throw exception:(TypeError): Cannot call method 'toString' of null 
    //                             String id=RPCManager.getCurrentTransactionId()
    
                                   //no error,no exception,but nothing happen
    				RPCManager.cancelQueue();				
    
                                    //the line will prompt RPCManager:clearTransaction: no such transaction: 8
    //				RPCManager.clearTransaction(tranID);
    
    			}
    			
    		});
    the transition from chrome's debug tool
    Code:
    _transaction:
    <transaction xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:type="xsd:Object">
    <transactionNum xsi:type="xsd:long">8</transactionNum>
    <operations xsi:type="xsd:List"><elem xsi:type="xsd:Object"><criteria xsi:type="xsd:Object"></criteria>
    <operationConfig xsi:type="xsd:Object"><dataSource>userGroup</dataSource>
    <operationType>fetch</operationType>
    <textMatchStyle>exact</textMatchStyle></operationConfig>
    <startRow xsi:type="xsd:long">0</startRow><endRow xsi:type="xsd:long">75</endRow>
    <componentId>isc_CanSeleGrid_0</componentId><appID>builtinApplication</appID>
    <operation>userGroup_fetch</operation>
    <oldValues xsi:type="xsd:Object"></oldValues>
    </elem></operations></transaction>
    the request
    Code:
    {
        "actionURL":"http://localhost:28080/spms/sc/IDACall", 
        "showPrompt":true, 
        "prompt":"***", 
        "transport":"xmlHttpRequest", 
        "promptStyle":"cursor", 
        "bypassCache":true, 
        "data":{
            "criteria":{
            }, 
            "operationConfig":{
                "dataSource":"userGroup", 
                "repo":null, 
                "operationType":"fetch", 
                "textMatchStyle":"exact"
            }, 
            "startRow":0, 
            "endRow":75, 
            "componentId":"isc_CanSeleGrid_3", 
            "appID":"builtinApplication", 
            "operation":"userGroup_fetch", 
            "oldValues":{
            }
        }
    }
    response
    Code:
        {
            errors:[
                {
                }
            ], 
            isDSResponse:true, 
            invalidateCache:false, 
            status:-999,   //MY_CUSTOM_ERROR_CODE 
            data:null, 
            tranID:8
        }
    the track from Console

    Code:
    10:45:01.207:INFO:ResultSet:isc_CanSeleGrid_3:Creating new isc.ResultSet for operation 'userGroup_fetch' with filterValues: {
    }
    10:45:01.208:INFO:ResultSet:isc_ResultSet_8 (created by: isc_CanSeleGrid_3):setCriteria: filter criteria changed, invalidating cache
    10:45:01.208:INFO:ResultSet:isc_ResultSet_8 (created by: isc_CanSeleGrid_3):Invalidating cache
    10:45:01.212:INFO:ResultSet:isc_ResultSet_8 (created by: isc_CanSeleGrid_3):getRange(0, 1) will fetch from 0 to 75
    10:45:01.212:INFO:ResultSet:isc_ResultSet_8 (created by: isc_CanSeleGrid_3):fetching rows 0,75 from server
    10:45:01.245:INFO:RPCManager:sendQueue[11]: 1 RPCRequest(s); transport: xmlHttpRequest; target: http://localhost:28080/spms/sc/IDACall?isc_rpc=1&isc_v=SC_SNAPSHOT-2011-01-05&isc_xhr=1&isc_tnum=11
    10:45:01.626:XRP2:INFO:RPCManager:transaction 11 arrived after 381ms
    10:45:01.627:XRP2:INFO:RPCManager:rpcResponse(userGroup_fetch)[fetch]: result: object[status=-999]
    10:45:01.627:XRP2:INFO:ResultSet:isc_ResultSet_8 (created by: isc_CanSeleGrid_3):Received 0 records from server
    10:45:01.627:XRP2:INFO:ResultSet:isc_ResultSet_8 (created by: isc_CanSeleGrid_3):cached 0 rows, from 0 to 0 (0 total rows, 0 cached)
    10:45:01.627:XRP2:INFO:ResultSet:isc_ResultSet_8 (created by: isc_CanSeleGrid_3):Cache for entire DataSource complete
    Last edited by oldwatch; 23 Jan 2013, 19:42.
Working...
X