Ticket #5398 (new enhancement)
Syntax Error catching in dojo loader
| Reported by: | guest | Owned by: | jburke |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.2 |
| Component: | PackageSystem | Version: | 1.0 |
| Severity: | normal | Keywords: | loader debugging error debugAtAllCosts |
| Cc: | mike@…, alex |
Description
I'm submitting a patch for dojo._base._loader.loader.js
When there is a js syntax error in a package file, the loader pretty much just gives up and throws an error. Consequently that error points to the loader file, which is useless. It often does give the proper syntax error (missing a '}'). However, in the case of large files, a file that had many changes done to it, or a file that you did not work on, a line number, or a snippet of code in the erroneous area become invaluable, and saves trips to jslint.com.
I've inserted a block of code that determines if the error was due to a file not found (in which case it does nothing) or a syntax error, in which case it loads the suspect file into a script tag in the head. This file is then parsed by the browser and throws a syntax error message. Clicking on the error shows a snippet of code in that location. In IE, the correct script opens in the debugger, highlighting the line with the error.