From 642d86579f6c435f0df22b8c09b78e0438348de2 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 18 Aug 2021 18:43:05 +0800 Subject: [PATCH] handle exception on store load if paging toolbar is used --- docs/src/Roo_data_HttpProxy.js.html | 10 +++------- roojs-all.js | 4 ++-- roojs-bootstrap-debug.js | 10 +++------- roojs-bootstrap.js | 4 ++-- roojs-debug.js | 10 +++------- roojs-ui-debug.js | 10 +++------- roojs-ui.js | 4 ++-- 7 files changed, 18 insertions(+), 34 deletions(-) diff --git a/docs/src/Roo_data_HttpProxy.js.html b/docs/src/Roo_data_HttpProxy.js.html index 52b00a8fdb..d0edc0139d 100644 --- a/docs/src/Roo_data_HttpProxy.js.html +++ b/docs/src/Roo_data_HttpProxy.js.html @@ -129,14 +129,10 @@ try { result = o.reader.read(response); }catch(e){ + o.success = false; + o.raw = { errorMsg : response.responseText }; this.fireEvent("loadexception", this, o, response, e); - o.request.callback.call(o.request.scope, { - success : false, - raw : { - errorMsg : response.responseText - } - - }, o.request.arg, false); + o.request.callback.call(o.request.scope, o, o.request.arg, false); return; } diff --git a/roojs-all.js b/roojs-all.js index 3015d073db..4cadc9f99f 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -979,8 +979,8 @@ Roo.data.MemoryProxy=function(A){if(A.data){A=A.data;}Roo.data.MemoryProxy.super // Roo/data/HttpProxy.js Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{} ,request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}this.activeRequest=Roo.Ajax.request(o);}else{this.conn.request(o);}}else{C.call(D||this,null,E,false); -}},loadResponse:function(o,A,B){delete this.activeRequest;if(!A){this.fireEvent("loadexception",this,o,B);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}var C;try{C=o.reader.read(B);}catch(e){this.fireEvent("loadexception",this,o,B,e); -o.request.callback.call(o.request.scope,{success:false,raw:{errorMsg:B.responseText}},o.request.arg,false);return;}this.fireEvent("load",this,o,o.request.arg);o.request.callback.call(o.request.scope,C,o.request.arg,true);},update:function(A){},updateResponse:function(A){} +}},loadResponse:function(o,A,B){delete this.activeRequest;if(!A){this.fireEvent("loadexception",this,o,B);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}var C;try{C=o.reader.read(B);}catch(e){o.success=false;o.raw={errorMsg:B.responseText} +;this.fireEvent("loadexception",this,o,B,e);o.request.callback.call(o.request.scope,o,o.request.arg,false);return;}this.fireEvent("load",this,o,o.request.arg);o.request.callback.call(o.request.scope,C,o.request.arg,true);},update:function(A){},updateResponse:function(A){} }); // Roo/data/ScriptTagProxy.js Roo.data.ScriptTagProxy=function(A){Roo.data.ScriptTagProxy.superclass.constructor.call(this);Roo.apply(this,A);this.head=document.getElementsByTagName("head")[0];};Roo.data.ScriptTagProxy.TRANS_ID=1000;Roo.extend(Roo.data.ScriptTagProxy,Roo.data.DataProxy,{timeout:30000,callbackParam:"callback",nocache:true,load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var p=Roo.urlEncode(Roo.apply(A,this.extraParams)); diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 8a2a9f65b1..a3cf4d4450 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -16245,14 +16245,10 @@ Roo.extend(Roo.data.HttpProxy, Roo.data.DataProxy, { try { result = o.reader.read(response); }catch(e){ + o.success = false; + o.raw = { errorMsg : response.responseText }; this.fireEvent("loadexception", this, o, response, e); - o.request.callback.call(o.request.scope, { - success : false, - raw : { - errorMsg : response.responseText - } - - }, o.request.arg, false); + o.request.callback.call(o.request.scope, o, o.request.arg, false); return; } diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 2eaf80581e..509c9b3429 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -678,8 +678,8 @@ Roo.data.MemoryProxy=function(A){if(A.data){A=A.data;}Roo.data.MemoryProxy.super // Roo/data/HttpProxy.js Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{} ,request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}this.activeRequest=Roo.Ajax.request(o);}else{this.conn.request(o);}}else{C.call(D||this,null,E,false); -}},loadResponse:function(o,A,B){delete this.activeRequest;if(!A){this.fireEvent("loadexception",this,o,B);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}var C;try{C=o.reader.read(B);}catch(e){this.fireEvent("loadexception",this,o,B,e); -o.request.callback.call(o.request.scope,{success:false,raw:{errorMsg:B.responseText}},o.request.arg,false);return;}this.fireEvent("load",this,o,o.request.arg);o.request.callback.call(o.request.scope,C,o.request.arg,true);},update:function(A){},updateResponse:function(A){} +}},loadResponse:function(o,A,B){delete this.activeRequest;if(!A){this.fireEvent("loadexception",this,o,B);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}var C;try{C=o.reader.read(B);}catch(e){o.success=false;o.raw={errorMsg:B.responseText} +;this.fireEvent("loadexception",this,o,B,e);o.request.callback.call(o.request.scope,o,o.request.arg,false);return;}this.fireEvent("load",this,o,o.request.arg);o.request.callback.call(o.request.scope,C,o.request.arg,true);},update:function(A){},updateResponse:function(A){} }); // Roo/data/ScriptTagProxy.js Roo.data.ScriptTagProxy=function(A){Roo.data.ScriptTagProxy.superclass.constructor.call(this);Roo.apply(this,A);this.head=document.getElementsByTagName("head")[0];};Roo.data.ScriptTagProxy.TRANS_ID=1000;Roo.extend(Roo.data.ScriptTagProxy,Roo.data.DataProxy,{timeout:30000,callbackParam:"callback",nocache:true,load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var p=Roo.urlEncode(Roo.apply(A,this.extraParams)); diff --git a/roojs-debug.js b/roojs-debug.js index d0db039f83..b0324ed6ca 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -25435,14 +25435,10 @@ Roo.extend(Roo.data.HttpProxy, Roo.data.DataProxy, { try { result = o.reader.read(response); }catch(e){ + o.success = false; + o.raw = { errorMsg : response.responseText }; this.fireEvent("loadexception", this, o, response, e); - o.request.callback.call(o.request.scope, { - success : false, - raw : { - errorMsg : response.responseText - } - - }, o.request.arg, false); + o.request.callback.call(o.request.scope, o, o.request.arg, false); return; } diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 3e7cd561db..c5429db379 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -1564,14 +1564,10 @@ Roo.extend(Roo.data.HttpProxy, Roo.data.DataProxy, { try { result = o.reader.read(response); }catch(e){ + o.success = false; + o.raw = { errorMsg : response.responseText }; this.fireEvent("loadexception", this, o, response, e); - o.request.callback.call(o.request.scope, { - success : false, - raw : { - errorMsg : response.responseText - } - - }, o.request.arg, false); + o.request.callback.call(o.request.scope, o, o.request.arg, false); return; } diff --git a/roojs-ui.js b/roojs-ui.js index 57e91ba504..063eb94652 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -58,8 +58,8 @@ Roo.data.MemoryProxy=function(A){if(A.data){A=A.data;}Roo.data.MemoryProxy.super // Roo/data/HttpProxy.js Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{} ,request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}this.activeRequest=Roo.Ajax.request(o);}else{this.conn.request(o);}}else{C.call(D||this,null,E,false); -}},loadResponse:function(o,A,B){delete this.activeRequest;if(!A){this.fireEvent("loadexception",this,o,B);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}var C;try{C=o.reader.read(B);}catch(e){this.fireEvent("loadexception",this,o,B,e); -o.request.callback.call(o.request.scope,{success:false,raw:{errorMsg:B.responseText}},o.request.arg,false);return;}this.fireEvent("load",this,o,o.request.arg);o.request.callback.call(o.request.scope,C,o.request.arg,true);},update:function(A){},updateResponse:function(A){} +}},loadResponse:function(o,A,B){delete this.activeRequest;if(!A){this.fireEvent("loadexception",this,o,B);o.request.callback.call(o.request.scope,null,o.request.arg,false);return;}var C;try{C=o.reader.read(B);}catch(e){o.success=false;o.raw={errorMsg:B.responseText} +;this.fireEvent("loadexception",this,o,B,e);o.request.callback.call(o.request.scope,o,o.request.arg,false);return;}this.fireEvent("load",this,o,o.request.arg);o.request.callback.call(o.request.scope,C,o.request.arg,true);},update:function(A){},updateResponse:function(A){} }); // Roo/data/ScriptTagProxy.js Roo.data.ScriptTagProxy=function(A){Roo.data.ScriptTagProxy.superclass.constructor.call(this);Roo.apply(this,A);this.head=document.getElementsByTagName("head")[0];};Roo.data.ScriptTagProxy.TRANS_ID=1000;Roo.extend(Roo.data.ScriptTagProxy,Roo.data.DataProxy,{timeout:30000,callbackParam:"callback",nocache:true,load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var p=Roo.urlEncode(Roo.apply(A,this.extraParams)); -- 2.39.2