View Full Version : How to catch and handle exception??
kkbear
26 Sep 2007, 5:26 PM
HI all,I;ve got a problem:
As my service throw an exception,How the ext catch and handle it?
I know the form submit could with success/failure callback functions;
but how about when a data.store(or any other loader) load()??
evant
26 Sep 2007, 5:27 PM
Check the documentation:
http://extjs.com/deploy/ext/docs/output/Ext.data.Store.html#event-loadexception
kkbear
26 Sep 2007, 8:21 PM
Thx..
I used the loadException event and it work well.
but I want to show exception info when call loadException callback method,how to make it??
evant
26 Sep 2007, 8:38 PM
Read the documentation about the loadException event:
Fires if an exception occurs in the Proxy during loading. Called with the signature of the Proxy's "loadexception" event.
kkbear
26 Sep 2007, 9:12 PM
Read the documentation about the loadException event:
Yes,but...What can do when an exception occurs,I can not catch the exception and show this exception info to user.
evant
26 Sep 2007, 9:24 PM
You aren't listening, read what the documentation says:
Fires if an exception occurs in the Proxy during loading. Called with the signature of the Proxy's "loadexception" event.
This means that the loadexception on the store is passed in the load exception information for whatever proxy you're using.
kkbear
26 Sep 2007, 9:32 PM
I'm sorry ,can u make an example about this,how the proxy response the exception and Ext catch it..
evant
26 Sep 2007, 9:48 PM
No, it depends on what type of reader you're using
myStore.on('loadexception', function(//the arguments here will be whatever your reader passes when there is a load exception)
{
}
);
kkbear
26 Sep 2007, 10:32 PM
yes,but i don't think this function has any params
Subscribers will be called with the following parameters:
None
isn't it?
evant
26 Sep 2007, 10:40 PM
You need to read this very carefully, don't respond until you've read it a few times:
loadexception
public event loadexception
Fires if an exception occurs in the Proxy during loading. Called with the signature of the Proxy's "loadexception" event.
Subscribers will be called with the following parameters:
* None.
This event is defined by Store.
kumar303
25 Aug 2008, 12:17 PM
well, you know what evant, the docs are really confusing and don't help at all.
Here is what I ended up doing:
myStore.on("loadexception", function() {
console.log("got some load exceptions:");
console.log(arguments);
});
buried inside several configuration arguments was a somewhat helpful message that led me to realize that I used the wrong type declaration in one of my fields. That message should be displayed in the Load Exception message, IMHO.
mjlecomte
25 Aug 2008, 3:36 PM
I added a suggestion to doc thread:
http://extjs.com/forum/showthread.php?p=214209#post214209
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.