joyent/node — pull request #3816 by AndreasMadsen (2012-08-03 15:03:51+00:00)
Title: Improve call-stacks in async fs oprations

Before the patch:

```JavaScript
fs.open('/missing', 'r', function (e) { console.error(e.stack); });
```

would output `Error: ENOENT, open './missing/'` with no stack trace.

With this patch, a complete stack trace is returned:

```
Error: ENOENT, open './missing/'
at makeCallback (fs.js:296:15)
at Object.fs.open (fs.js:325:14)
at Object. (/Users/Andreas/GitHub/node/stack.js:4:4)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:487:10)
at exports.bindHistory (util.js:531:14)
```

The patch expose a `util._bindHistory` method there handle all the magic, I did not put it in `fs` since could be useful in other core modules. However I'm too lazy to check them now :)