Skip to content
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.

[domains] domain.intercept - remove err argument from cb function #3379

Closed
@wavded

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
}));

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions