PDA

View Full Version : [OPEN-EXTJSIV-298] Ext.require - add error for not found resources



LesJ
23 Mar 2011, 11:41 AM
It would help if Ext.require() improved error handling when loading resources that are not found.

As a demo, follow this link:

http://dev.sencha.com/deploy/LoaderDemo/

Then run in Firebug's console:

Ext.require('Test', function() {
alert("got Test");
});

An error should result since Test was not found, but there was no error.

As an example, RequireJS (another loader) issues a helpful error message.

If I run the code below and the module "scorecard/app2" is not found, I get an error message "require.js load timeout for modules: scorecard/app2".

require({baseUrl: "InventoryMetrics/js/"}, ["menu", "scorecard/app2"]);

LesJ
24 Mar 2011, 4:50 AM
Also, there should be a loader wait configuration option that would allow to specify how many seconds loader should wait before giving up on loading the resource.

In any case, issuing an error message when a resource can't be loaded would improve debugging.

n3rd
24 Mar 2011, 4:55 AM
I submitted a similar feature request earlier today: http://www.sencha.com/forum/showthread.php?127862

Jacky Nguyen
24 Mar 2011, 10:59 AM
It would help if Ext.require() improved error handling when loading resources that are not found.

As a demo, follow this link:

http://dev.sencha.com/deploy/LoaderDemo/

Then run in Firebug's console:

Ext.require('Test', function() {
alert("got Test");
});

An error should result since Test was not found, but there was no error.

As an example, RequireJS (another loader) issues a helpful error message.

If I run the code below and the module "scorecard/app2" is not found, I get an error message "require.js load timeout for modules: scorecard/app2".

require({baseUrl: "InventoryMetrics/js/"}, ["menu", "scorecard/app2"]);

The demo used a very early version of Ext.Loader. Error handling has been tremendously improved in the latest code base. More docs on this are on the way.

Jacky Nguyen
24 Mar 2011, 11:01 AM
Also, there should be a loader wait configuration option that would allow to specify how many seconds loader should wait before giving up on loading the resource.

In any case, issuing an error message when a resource can't be loaded would improve debugging.

A timeout configuration is indeed useful, I'll add one in.

DerSalz
20 Nov 2011, 10:14 PM
I'm using Ext 4.0.7 and the problem still exists. Nothing has changed. It's a nightmare if the application simply stops and you are not able to see what's wrong.

"The demo used a very early version of Ext.Loader. Error handling has been tremendously improved in the latest code base. More docs on this are on the way."

I can't see any improvments... What has changed? How can I catch dynamic loading exceptions?

Thanks and regards

Similar threads:

http://www.sencha.com/forum/showthread.php?127862-OPEN-EXTJSIV-298-Custom-error-handling-for-Ext.Loader&p=676966#post676966

http://www.sencha.com/forum/showthread.php?136999 (http://www.sencha.com/forum/showthread.php?127862-OPEN-EXTJSIV-298-Custom-error-handling-for-Ext.Loader&p=676966#post676966)

DerSalz
20 Nov 2011, 10:35 PM
I'm using now ext-all-dev.js instead of ext-all-debug.js and now I'm getting uncaught exceptions in the console which tells me what files / classes could not be loaded.

Maybe this is mentioned in the documentation but I didn't see it. If it is the right way using ext-all-dev.js this should be written highlighted somewhere (e.g. FAQs) or at least in the dynamic loading section of the documentation.

iTolik
20 Mar 2012, 9:59 AM
The behavior appears even more interesting if the missing type name is misspelled only slightly. I am evaluating 4.1-RC1, and while extending the data store I accidentally wrote the following:

extend: 'Ext.data.store'

Note the small "s" instead of the capital one. When ext-all-dev.js is linked, I see a console error because the loader is trying to fetch the file from ./data/store.js relative to my application root folder (where the .html file was loaded from) which is already strange since it should be going against the Ext top folder as the namespace is clearly specified. But at least some error is visible.

On the other hand, if I link ext-debug.js instead. no error shows up anywhere. Not even a 404 for a missing file, because /Ext/data/store.js in the URL happily fetches /Ext/data/Store.js instead. Dynamic loader does not appear to validate what it fetched too diligently.

I wonder if I am missing some simple debugging technique (I am new to Ext JS), or more advanced error handling within the loader is in order.

LesJ
23 Apr 2013, 7:21 AM
I believe this is bug is fixed(?).

Using 4.2, I get 'Failed loading...' error message. No error was issued in 4.1.

Tomas Pospisek
23 Apr 2013, 8:43 AM
I believe this is bug is fixed(?).

Using 4.2, I get 'Failed loading...' error message. No error was issued in 4.1.

Not in 4.2.0 as far as I can see: http://www.sencha.com/forum/showthread.php?262072-quot-requires-quot-silently-fails&p=960303#post960303