sbt / sbt-jshint

Allows jslint to be used from within sbt. Builds on com.typesafe:webdriver in order to execute jslint.js along with the scripts to verify
Other
21 stars 20 forks source link

Confusing error report in case of typos in configuration file #31

Open myrosia opened 9 years ago

myrosia commented 9 years ago

I had a typo in my configuration file (an extra comma). This resulted in the following exception

    com.typesafe.sbt.jse.SbtJsTask$JsTaskFailure: 
undefined:7
}
^
SyntaxError: Unexpected token }
    at Object.parse (native)
    at /afs/inf.ed.ac.uk/user/m/mdzikovs/research/ideal/software/gui/play-upgrade-branch/project/target/jshint/sbt-jshint-1.0.3.jar:30:24
    at Object.<anonymous> (/afs/inf.ed.ac.uk/user/m/mdzikovs/research/ideal/software/gui/play-upgrade-branch/project/target/jshint/sbt-jshint-1.0.3.jar:67:2)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)                                                                                                               
    at node.js:906:3

Eventually I figured out that the cause was coming from from jshint-shell.js line 30 var options = JSON.parse(stripJsonComments(args[OPTIONS_ARG]));

This helped me find the source (configuration file error). But it would be better if it was reported properly, because it is impossible to guess from the error message what the cause is.