Catch and handle parsing errors

Catch and handle exceptions thrown by detective/esprima. (The exception was uncaught, crashing the application.)
Add filename in error message to help fixing javascript errors.