I'm not sure if this is a problem in fs-promise, or something deeper, or maybe I'm doing something wrong (probably the latter): but if a Promise.catch on a top level promise catches something from deeper inside, it's missing the stack trace.
Example code to reproduce:
const fsp = require('fs-promise');
function readFile() {
return fsp.readFile('./doesntexist', 'utf-8');
}
function main() {
return readFile();
}
main().catch(err => {
console.error(err); // err has no stack trace
console.error(err.stack) // doesn't contain stack trace, where did the error come from?
});
Would be nice to have that stack trace to figure out when things go wrong in a more complicated real-world example.
I'm not sure if this is a problem in fs-promise, or something deeper, or maybe I'm doing something wrong (probably the latter): but if a
Promise.catch
on a top level promise catches something from deeper inside, it's missing the stack trace.Example code to reproduce:
Would be nice to have that stack trace to figure out when things go wrong in a more complicated real-world example.