Hybrid View

  1. #1
    Touch Premium Member
    Join Date
    Sep 2011
    Posts
    69
    Vote Rating
    2
    pdm is on a distinguished road

      0  

    Default Uncaught TypeError is not helpful

    Uncaught TypeError is not helpful


    i'm trying to port an Ext 4 app to Touch 2 and I keep getting
    Code:
    Uncaught TypeError: object is not a function
    in Chrome. This is really unhelpful to work out what I've done wrong.

    Just now it was that I had layout: 'anchor' in a fieldset, but I've had this too for invalid xtypes.

    Perhaps this could be caught earlier and echoed in the debug as wrong.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,546
    Vote Rating
    873
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    If you would have set a breakpoint and watched the call stack... that would have told you better where your error is happening.

    Further more, what JS files are you using? Not all have the logger
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Touch Premium Member
    Join Date
    Sep 2011
    Posts
    69
    Vote Rating
    2
    pdm is on a distinguished road

      0  

    Default


    Yes, I can debug the whole thing myself, but that's not very helpful. The functions that error are generic and called multiple times on load. Or I can start on the error and work backwards, which also takes a while. I've been doing it all day and it's tedious.

    I'm using sencha-touch-all-uncompressed-w-comments.js touch 2 pr2. If I use sencha-touch-all-debug-w-comments.js it doesn't even throw an error - it just stops running. Am I doing something wrong?

  4. #4
    Sencha User
    Join Date
    Jul 2011
    Posts
    7
    Vote Rating
    0
    Martialen is on a distinguished road

      0  

    Default


    You're definitely right, pdm. One of the most challenging things in using Sencha Touch, and ExtJS is debugging when something goes wrong. The errors thrown are basically in greek. This is really frustrating when you're just beginning and when your boss (or your wife) wonders what's taking you so long to master such an "easy" and lightweight framework. But even when you've caught on, the slightest slip-up in naming will still rob you of a lot of dev time.

    Sencha needs to stop blaming developers for not being able to debug their own apps. A framework should be able to throw a helpful, contextual error when it is being misused. Especially when the mistake is a very very common one for beginners.

    For example: xtypes. There is a finite list of xtypes. Why can't Sencha write a small utility function that throws an error like "Invalid Xtype" when the value following xtype: isn't in the list?

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Posts
    13
    Vote Rating
    0
    juniorplenty is on a distinguished road

      0  

    Default Ditto.

    Ditto.


    Just spent a couple of hours trying to debug this:

    Uncaught TypeError: Cannot call method 'substring' of undefined

    (With corresponding disconnected stack trace.) Turns out it was because I didn't include the "type" attribute in a proxy config for a model. Nice one! Feh.