From c9e22777e7b306f3a0650b7b2d605550d6d4656a Mon Sep 17 00:00:00 2001 From: Hugo Loza Date: Wed, 22 Dec 2010 16:15:28 +0000 Subject: [PATCH] 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 --- .../engine/templates/cases/casesStartPage.js | 46 +++++++++++++------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/workflow/engine/templates/cases/casesStartPage.js b/workflow/engine/templates/cases/casesStartPage.js index ca77720cf..6725adbf2 100644 --- a/workflow/engine/templates/cases/casesStartPage.js +++ b/workflow/engine/templates/cases/casesStartPage.js @@ -118,7 +118,10 @@ var newCaseTree = { title : 'Start Case', msg : 'Starting new case

' + n.attributes.text + '', - icon : Ext.MessageBox.INFO + icon : Ext.MessageBox.INFO, + //width:300, + wait:true, + waitConfig: {interval:500} }); Ext.Ajax.request({ url : 'casesStartPage_Ajax.php', @@ -128,18 +131,35 @@ var newCaseTree = { taskId : n.attributes.tas_uid }, success : function(response) { - var res = Ext.util.JSON.decode(response.responseText); - if (res.openCase) { - window.location = res.openCase.PAGE; - } else { - Ext.Msg.show({ - title : 'Error creating a new Case', - msg : '', - icon : Ext.MessageBox.ERROR, - buttons : Ext.Msg.OK - }); - } + + try{ + var res = Ext.util.JSON.decode(response.responseText); + + if (res.openCase) { + window.location = res.openCase.PAGE; + } else { + Ext.Msg.show({ + title : 'Error creating a new Case', + msg : '', + icon : Ext.MessageBox.ERROR, + buttons : Ext.Msg.OK + }); + } + } catch(e) { + Ext.Msg.show({ + title : 'Error creating a new Case', + msg : 'JSON Decode Error:

Server Response
', + icon : Ext.MessageBox.ERROR, + buttons : Ext.Msg.OK + }); + + } + + + + }, failure : function() { // grid.getGridEl().unmask(true);