Uncaught SyntaxError: Unexpected end of input

At run time I get this error in the debugger for the last line of code. I know what the error is, but my project is fairly large (over 20,000 lines) and I was wondering if there was a quick way of finding where the cause of the error is. (I know I’m probably missing an ‘End If’ or ‘Next’, but how do I find it in 20,000 lines of code?)

Here’s one idea: Run the app. In Chrome Tools, go to the Sources tab and open code.js.

At the bottom left, there is a {} icon. Click on that and Chrome will format your code. You may be to spot the problem after that.

Another easy way to find the missing end if or end function is to highlight a large section of code (beginning with ‘Function …’ and ending with ‘End Function’, right click and select ‘Format code’. If the last line is not indented, there is no error in that section. I usually do this with all the code for a form, and then move on to the next form.
Helen

Another method is to use /* and */ around sections of code till the error disappears, then shrink the section till you find the errant lines.

Thanks for your help - I’d been working on this for a day and after using your suggestion I found the problem within an hour

One more suggestion: if you’re using JavaScript, the elint button at the top does a complete syntax and style check of your code.

https://blog.appstudio.dev/2018/10/as7-syntax-checking-for-javascript/

Share your story with the AppStudio Community! Quarantine Stories