Results 1 to 7 of 7

Thread: getting helpful error messages?

  1. #1
    TheMonolith
    Guest

    Exclamation getting helpful error messages?

    For the 379th time I spend at least half an hour looking for a simple spelling or paranthesis mistake that could have been resolved within a few seconds had there been a helpful error message.

    Last time, which was 5 minutes ago, I got the following error messages:

    Code:
    G is undefined
    }else  if(!comp.events){ ext-all-debug.js  (line 18839)
    
    comp is undefined
    }else  if(!comp.events){ ext-all-debug.js  (line 18839)
    
    
    comp is undefined
    }else  if(!comp.events){ ext-all-debug.js  (line 18839)
    
    
    comp is undefined
    }else  if(!comp.events){ ext-all-debug.js  (line 18839
    Finally, after going through every line of code and having two co-workers proof-read it,
    I discovered the problem: I had spelled "Ext.form.Fieldset" instead of "Ext.form.FieldSet".

    Why is Ext JS often unable to provide helpful error messages? Is there an architectural reason for that?

    I mean I already use ext-all-debug.js and Firebug. What else could I do?

  2. #2
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750

    Default

    1. Use a decent IDE, with ExtJS Code Assist, Syntax Checking, etc.

    2. Run your code through www.jslint.com. Note, some of the IDEs have this built-in.

    3. If using JSON, run it through www.jsonlint.com. Again, some of the IDEs have this built-int.

    4. If using XML, run it through www.xmlvalidation.com.

  3. #3
    TheMonolith
    Guest

    Default

    Thanks for the succinct advice fay.

    I'm already using Aptana and have also installed Ext JS support, but just found out that Code Assist was not activated for Ext (even though I thought I had activated it).

    I also switched from Mozilla JavaScript Validator to JSLint JavaScript Validator. It helped me solve some formal issues.

    The JSONLint page you pointed out to me is not very helpful I'm afraid because it throws errors when you write xtype: "panel" instead of "xtype": "panel".

    After all this, I'm still getting some cryptic error messages when I run my Ext JS script...

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Well, those aren't really cryptic. They tell you what's happened and where.

  5. #5
    TheMonolith
    Guest

    Default

    Okay, now I get these 6 error messages:

    Code:
    types[config.xtype  || defaultType] is not a constructor
    }else  if(!comp.events){ ext-all-debug.js  (line18839)
    
    comp is undefined
    }else  if(!comp.events){ ext-all-debug.js  (line18839)
    
    
    comp is undefined
    }else  if(!comp.events){ ext-all-debug.js  (line18839)
    
    
    comp is undefined
    }else  if(!comp.events){ ext-all-debug.js  (line18839)
    
    
    comp is undefined
    }else  if(!comp.events){ ext-all-debug.js  (line18839)
    
    
    comp is undefined
    }else  if(!comp.events){ ext-all-debug.js  (line18839)
    I have checked each of my 12 project files with JSLint and there is no syntax error. Aptana doesn't find any errors, either.

  6. #6
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    So. It's calling

    Code:
    new types[config.xtype](blah...);
    And it's dropping out with the error that that is not a constructor.

    So you break in debug, see what config.xtype IS, and realize that you do not have that class in your page. Either you forgot to add it in, or it is 404.

  7. #7
    TheMonolith
    Guest

    Default

    As usual, your answer is right to the point. I forgot to add the script that contains the class that defines the type.

    Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •