diff options
Diffstat (limited to 'tools/eslint/bin/eslint.js')
-rw-r--r--[-rwxr-xr-x] | tools/eslint/bin/eslint.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tools/eslint/bin/eslint.js b/tools/eslint/bin/eslint.js index 598b568ba4..19e5720a71 100755..100644 --- a/tools/eslint/bin/eslint.js +++ b/tools/eslint/bin/eslint.js @@ -29,12 +29,31 @@ if (debug) { // now we can safely include the other modules that use debug var concat = require("concat-stream"), - cli = require("../lib/cli"); + cli = require("../lib/cli"), + path = require("path"), + fs = require("fs"); //------------------------------------------------------------------------------ // Execution //------------------------------------------------------------------------------ +process.on("uncaughtException", function(err){ + // lazy load + var lodash = require("lodash"); + + if (typeof err.messageTemplate === "string" && err.messageTemplate.length > 0) { + var template = lodash.template(fs.readFileSync(path.resolve(__dirname, "../messages/" + err.messageTemplate + ".txt"), "utf-8")); + + console.log("\nOops! Something went wrong! :("); + console.log("\n" + template(err.messageData || {})); + } else { + console.log(err.message); + console.log(err.stack); + } + + process.exit(1); +}); + if (useStdIn) { process.stdin.pipe(concat({ encoding: "string" }, function(text) { try { |