Results 1 to 7 of 7

Thread: Debugging Syntax Errors in EXTJS (JSON) and pulling out your hair

  1. #1
    Ext JS Premium Member
    Join Date
    Sep 2009
    Location
    Cypress, Kalifornia
    Posts
    304

    Default Debugging Syntax Errors in EXTJS (JSON) and pulling out your hair

    I've been coding EXTJS since 2008. However, one of the biggest pet peeves I have is finding syntax errors. I'm using RAD 9.5 (Eclipse) and the editors don't tag missing brackets, attributes, etc. Basically my eyes are the compiler which sucks.

    I had a column definition which contained this name attribute pair: "flex: ," Duh, I forgot to make it "flex: 1,"

    Took me more time than I wanted to find the typo. One solution would be to add tiny bits of code then test. Add more tiny bits of code then test. But if you know what you're doing then you just want to code the whole damned thing.

    So, does anybody have any magic bullets for this that could give me a better solution? Various browser debuggers don't help much. Ideally, I'd like a Java-like editor for JSON/EXTJS type code.

    -Doug

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448

    Default

    If you had something like this:

    Code:
    columns : [
        {
            text      : 'Url',
            flex      : ,
            dataIndex : 'url'
        }
    ]
    Wouldn't you get a nice syntax error message in the browser with the file name and line number and click on the file name it'd take you directly to that line with a red squiggly?

    Seems like this would be pretty easy to debug:

    Screen Shot 2015-12-29 at 3.10.32 PM.jpg

    Screen Shot 2015-12-29 at 3.10.40 PM.png

    The only time I don't get giant fingers pointing at my code is if it's in a compile file (then it can be hard to figure out where but you can prettify the code in chrome/firefox) or if it's in an Ext JS template where the javascript code is generated from that template code.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Ext JS Premium Member
    Join Date
    Sep 2009
    Location
    Cypress, Kalifornia
    Posts
    304

    Default

    I am using IE 11. Perhaps my problem.

  4. #4
    Sencha Premium Member
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    341

    Default

    Another reason why one should get some kind of static typing (be it typescript on top of Ext JS)

  5. #5
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448

    Default

    Quote Originally Posted by Ekambos View Post
    Another reason why one should get some kind of static typing (be it typescript on top of Ext JS)
    In the case of a syntax error like the OP has, static typing wouldn't get you anything. If you have to compile the code and it produces an error, running it in the browser will also produce an error. Working within an IDE/editor, I use Brackets (used to use IntelliJ) and both clearly show syntax errors without any additional help from meta data provided from static typing.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  6. #6
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448

    Default

    Quote Originally Posted by dougbieber View Post
    I am using IE 11. Perhaps my problem.
    I've gotten syntax errors throw with meaningful file names and line numbers even back in IE6. With what you describe (and what the example I shown in my code and images) any browser should throw a syntax error. Syntax errors should be very easy to debug.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  7. #7
    Sencha Premium Member
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    341

    Default

    Both editors will show syntax like the one OP has for sure. Unfortunately there are way more other errors that those IDEs would nt catch that static analysis would catch right away.
    When I was using pure JavaScript I spend tooo much time chasing typo errors.

    So yes something like TypeScript on top of Ext would not hurt.

    Quote Originally Posted by mitchellsimoens View Post
    In the case of a syntax error like the OP has, static typing wouldn't get you anything. If you have to compile the code and it produces an error, running it in the browser will also produce an error. Working within an IDE/editor, I use Brackets (used to use IntelliJ) and both clearly show syntax errors without any additional help from meta data provided from static typing.

Similar Threads

  1. IE6 bug : no syntax errors and grid don't display data
    By marcus78 in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 4 Mar 2011, 6:51 AM
  2. Handling JSON syntax errors in form.load() ?
    By sacha in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 16 Nov 2010, 6:40 AM
  3. Debugging Errors
    By brookd in forum Sencha Cmd
    Replies: 1
    Last Post: 21 Nov 2009, 11:55 AM
  4. Pulling my hair... Please help...
    By bulgarian388 in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 7 Jan 2009, 5:11 PM
  5. debugging IE errors
    By sathishs in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 11 Mar 2008, 10:44 PM

Tags for this Thread

Posting Permissions

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