PDA

View Full Version : [OPEN] Better error message for unknown alias/xtype



preaction
28 Sep 2011, 3:09 PM
I keep misspelling xtypes or otherwise guessing incorrectly. Whenever I do, I'm given the error in firebug of "namespace is undefined" in a deep method. It would be nice if there was a better error message that would point out that an alias or class is unknown.

renku
29 Sep 2011, 6:00 AM
Looks like a perfectly good debug feature to have. Forwarding it to dev team.

evant
29 Sep 2011, 3:49 PM
Something like this already exists.

If you're using dynamic loading, you'll get an exception saying it couldn't load the file:


Uncaught Ext.Error: Failed loading synchronously via XHR: 'http://localhost:81/git/forks/sdk/extjs/src/panel/Pane.js'; please verify that the file exists. XHR status code: 404


If you're not using dynamic loading, you'll get:


Uncaught Ext.Error: Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. Missing required class: Ext.panel.Pane

renku
30 Sep 2011, 12:58 AM
@evant That's when you use full classnames. But the OP was referring to xtypes. For example:



Ext.create("Ext.Panel", {
items: [{xtype: "foo"}]
});

Ext.widget("foo");


These both give me quite a cryptic error message:


TypeError: Cannot call method 'substring' of undefined

Which is the Chrome equivalent of "namespace is undefined".

evant
30 Sep 2011, 3:30 PM
Ah, gotcha, sorry. I'll fix this up for 4.1.