View Full Version : 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
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.
28 Nov 2011, 8:02 AM
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
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
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
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.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.