RequestReduce
RequestReduce copied to clipboard
Script error causes other scripts to stop working
Hi again!
I have just worked around an issue I encountered. When I enabled RR, some js functionality stopped working.
I traced this to a line of code that at the very end of a Twitter Bootstrap script that called an undefined method. I think this then caused any scripts included after that to not be run.
I'm not sure if it's worth making the system tolerate this or not, but it was a bit tricky to figure out which script was failing. Anyway, to cut a long story short here are some ideas that might have helped with this
- to make it easier to track down the failing script, a console.log("executing script x.js) could be included in the concatenated script
- the scripts could be wrapped in try catch blocks which log the error so that one failing won't prevent execution of the next (not sure about this being a good thing though...)