Announcement
Collapse
No announcement yet.
X
-
Again, the RestDataSource has a format for how you report errors on the server. You need to follow that format. You can't have your server just return nonsense when the client has sent multiple requests together, you need to follow the protocol and provide a response for each request. Otherwise it is an unrecoverable total failure, analogous to the server just not responding at all.
-
hello,
I am sending the sample code below for the operation I want to do.
Code:var dsOperationBindings = [{ operationType: "fetch", dataProtocol: "postMessage", dataURL: "../CRUD/ProcessOperation" }, { operationType: "remove", dataProtocol:"postMessage", dataURL: "../CRUD/ProcessOperation" }, { operationType: "add", dataProtocol: "postMessage", dataURL: "../CRUD/ProcessOperation" }, { operationType: "update", dataProtocol: "postMessage", dataURL: "../CRUD/ProcessOperation" } ]; var dsFields = [ { name: "id", type: "sequence", primaryKey: true, title: "ID" }, { name: "parentId", title: "Parent ID", foreignKey: "id", rootValue: "0", detail: "true" }, { name: "name", title: "Object Name"}, { name: "description", title: "Objet Description" }] var parameters = {sirketKodu:02,ozelKod:"CEK", kullaniciKodu:"admin", programName:"prf202", dataSourceName:"CARMSF", programLanguage:"TR"}; var restds = isc.RestDataSource.create({ dataFormat: "json", fields: dsFields, jsonPrefix: "//'\"]]>>isc_JSONResponseStart>>", jsonSuffix: '//isc_JSONResponseEnd', operationBindings: dsOperationBindings, transformRequest: function (dsRequest) { if (!dsRequest.data) { dsRequest.data = {}; } dsRequest.data.sirketKodu = parameters.sirketKodu; dsRequest.data.ozelKod = parameters.ozelKod; dsRequest.data.kullaniciKodu = parameters.kullaniciKodu; dsRequest.data.programName = parameters.programName; dsRequest.data.programDataSource = parameters.dataSourceName; dsRequest.data.programLanguage = parameters.programLanguage; return this.Super("transformRequest", arguments); }, handleError: function (response, request) { if (response.data) { isc.Dialog.create({ message: "<b>" + status[response.status.toString()] + ": " + response.data.MainMessage + "<br><br>Hata Detayı:<br></b>" + response.data.Details, icon: "../../Images/System/error.png", isModal: true, title:"UYARI", buttons: [ isc.Button.create({ title: "OK" }), ], buttonClick: function (button, index) { this.destroy(); } }); return false; } return true; } //dataURL: "../CRUD/GetData", });
Code:restds.addData({id:"123654789",parentId:"9876555",name:"bookOne", description: "bookOnes description"}); restds.addData({id:"123654790",parentId:"9876555",name:"bookTwo", description: "bookTwos description"} )
Code:isc.RPCManager.addClassProperties({ handleError : function (response, request) { alert("error"); // server throw exception but can't handle } }); isc.RPCManager.startQueue(); restds.addData({id:"123654789",parentId:"9876555",name:"bookOne", description: "bookOnes description"}); restds.addData({id:"123654790",parentId:"9876555",name:"bookTwo", description: "bookTwos description"} ) isc.RPCManager.sendQueue(function(){ alert("Done"); });
when i changed the code as above restds makes one request. But i can't catch servers excepton "isc.RPCManager.handleError" or "restds.handleError" functions
Leave a comment:
-
If your server throws an Exception and the Exception is not a valid RestDataSource response, you should fix your server. The RestDataSource provides a protocol for reporting errors; just spitting back garbage is not something RestDataSource expects.
Leave a comment:
-
How can Hande Error isc.RPCManager.sendQueue()
I use “isc.RPCManager.sendQueue() “ method as follows. When server returns exception, i want to handle exception. But i can't. How can i handle error?
(when i don't use RPCManager, i handle eror with restdatasource)
Code:function saveFunction(){ /*adding, updating and removind data to the rest datasource*/ }; isc.RPCManager.addClassProperties({ handleError : function (response, request) { alert("error"); // server throw exception but can't handle } }); isc.RPCManager.startQueue(); saveFunction(); isc.RPCManager.sendQueue(function(){ alert("Done"); });
Tags: None
Leave a comment: