Error: ENOENT: no such file or directory, open 'path.js'
Error: ENOENT: no such file or directory, open 'path.js'
at Error (native)
at Object.fs.openSync (fs.js:634:18)
at Object.fs.readFileSync (fs.js:502:33)
at CallsiteRecord.renderSync (/Users/Vaughan/dev-live/shipmate/node_modules/callsite-record/lib/index.js:205:26)
at StackFormater._formater (/Users/Vaughan/dev-live/shipmate/lib/stack-format/index.js:58:40)
renderSync should handle the case where the file cannot be found...e.g. that it is a node.js internal.
CallsiteRecord.prototype.renderSync = function (opts) {
var fileContent = fs.readFileSync(this.filename).toString();
return this._renderRecord(fileContent, opts);
};
Nice find, thanks!
But, I've just remembered that it's an intended behavior. If you have a callsite record for unreadable source IMHO it's an exceptional situation. Do you have any ideas how it's can be handled more gracefully?
Any node.js internal will not be able to be resolved by path. Or if someone has modified the stack trace perhaps.
I think we should check if it exists, and provide an option to throw or swallow it.
Any node.js internal will not be able to be resolved by path.
Yes and we can't do anything with it.
I think we should check if it exists, and provide an option to throw or swallow it.
It's not a good option either. We should choose between throwing and returning null. But the problem with returning null is that it lacks the context of why it happens.
Looks like i have a similar problem, when trying to run example snippet:
Error: ENOENT: no such file or directory, open 'D:\Work\callsite-test1\example'
but i run it from D:\work\callsite-test(1)
Was hit by the same when the internet dropped on my instance:
Error: ENOENT: no such file or directory, open 'net.js'
at Object.openSync (fs.js:439:3)
at Object.readFileSync (fs.js:344:35)
at CallsiteRecord.renderSync (D:\code\cfstats\node_modules\callsite-record\lib\index.js:
So it crashed the whole thingy :)