Created
January 14, 2016 04:37
-
-
Save deepak/10273ddd4b140fce3803 to your computer and use it in GitHub Desktop.
nodejs error stack trace is obtuse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/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