Catch possible errors while Starting new case. Most of errors are due an invalid JSON response from server. So now that is catched and displayed
This commit is contained in:
@@ -118,7 +118,10 @@ var newCaseTree = {
|
|||||||
title : 'Start Case',
|
title : 'Start Case',
|
||||||
msg : 'Starting new case<br><br><b>' + n.attributes.text
|
msg : 'Starting new case<br><br><b>' + n.attributes.text
|
||||||
+ '</b>',
|
+ '</b>',
|
||||||
icon : Ext.MessageBox.INFO
|
icon : Ext.MessageBox.INFO,
|
||||||
|
//width:300,
|
||||||
|
wait:true,
|
||||||
|
waitConfig: {interval:500}
|
||||||
});
|
});
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url : 'casesStartPage_Ajax.php',
|
url : 'casesStartPage_Ajax.php',
|
||||||
@@ -128,18 +131,35 @@ var newCaseTree = {
|
|||||||
taskId : n.attributes.tas_uid
|
taskId : n.attributes.tas_uid
|
||||||
},
|
},
|
||||||
success : function(response) {
|
success : function(response) {
|
||||||
var res = Ext.util.JSON.decode(response.responseText);
|
|
||||||
if (res.openCase) {
|
try{
|
||||||
window.location = res.openCase.PAGE;
|
var res = Ext.util.JSON.decode(response.responseText);
|
||||||
} else {
|
|
||||||
Ext.Msg.show({
|
if (res.openCase) {
|
||||||
title : 'Error creating a new Case',
|
window.location = res.openCase.PAGE;
|
||||||
msg : '<textarea cols="50" rows="10">'
|
} else {
|
||||||
+ res.message + '</textarea>',
|
Ext.Msg.show({
|
||||||
icon : Ext.MessageBox.ERROR,
|
title : 'Error creating a new Case',
|
||||||
buttons : Ext.Msg.OK
|
msg : '<textarea cols="50" rows="10">'
|
||||||
});
|
+ res.message + '</textarea>',
|
||||||
}
|
icon : Ext.MessageBox.ERROR,
|
||||||
|
buttons : Ext.Msg.OK
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
Ext.Msg.show({
|
||||||
|
title : 'Error creating a new Case',
|
||||||
|
msg : 'JSON Decode Error:<br /><textarea cols="50" rows="2">'
|
||||||
|
+ e.message + '</textarea><br />Server Response<br /><textarea cols="50" rows="5">'+response.responseText+'</textarea>',
|
||||||
|
icon : Ext.MessageBox.ERROR,
|
||||||
|
buttons : Ext.Msg.OK
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
failure : function() {
|
failure : function() {
|
||||||
// grid.getGridEl().unmask(true);
|
// grid.getGridEl().unmask(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user