Skip to content

Instantly share code, notes, and snippets.

@deepak
Created January 14, 2016 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepak/10273ddd4b140fce3803 to your computer and use it in GitHub Desktop.
Save deepak/10273ddd4b140fce3803 to your computer and use it in GitHub Desktop.
nodejs error stack trace is obtuse
const fs = require('fs'),
fileName = process.argv[2];
if (!fileName) {
throw Error("need to specify file to watch!");
}
fs.watch(fileName, function() {
console.log("file '"+ fileName + "' just changed");
});
console.log("now watching '"+ fileName + "' for changes");
/Users/deepak/Code/ScratchPad/learning-node/filewatch.js:5
throw Error("need to specify file to watch!");
^
Error: need to specify file to watch!
at Error (native)
at Object.<anonymous> (/Users/deepak/Code/ScratchPad/learning-node/filewatch.js:5:11) # why Object.<anonymous> ?
at Module._compile (module.js:398:26)
at Object.Module._extensions..js (module.js:405:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:430:10)
at startup (node.js:141:18)
at node.js:1003:3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment