28 Nov 2011 4:13 AM #1
Uncaught TypeError is not helpful
i'm trying to port an Ext 4 app to Touch 2 and I keep getting
Uncaught TypeError: object is not a function
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.
28 Nov 2011 8:02 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
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 loggerMitchell Simoens @LikelyMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
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 firstname.lastname@example.org
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.
28 Nov 2011 8:34 AM #3
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?
28 Nov 2011 3:04 PM #4
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?
6 Jan 2012 12:06 AM #5
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.