This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
Closed
Description
Just throwing it out there for discussion. Been reviewing domains in 0.7.x and really glad we are getting them! Good work.
One API thing at the moment has bugged a me a few times that I thought it would be worth a discussion regardless of the outcome (and at the very least would help me understand the current design choices).
Right now domain.intercept
takes a callback that includes the err
argument but from what I see in the code (https://github.com/joyent/node/blob/master/lib/domain.js#L142-177) that error argument will always be null
if it makes it that far. Why not remove it entirely to give the user a tip off that intercept is actually taking care of that?
e.g.
var d = domain.create()
d.on('error', function (err) { /* handle errors */ })
fs.readFile('./foo', d.intercept(function (data) {
// do something with successfully returned data
}));