Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is ERR_MULTIPLE_CALLBACK missing a new? #532

Open
Jarred-Sumner opened this issue Feb 15, 2024 · 3 comments
Open

Is ERR_MULTIPLE_CALLBACK missing a new? #532

Jarred-Sumner opened this issue Feb 15, 2024 · 3 comments

Comments

@Jarred-Sumner
Copy link

ERR_MULTIPLE_CALLBACK is an Error subclass (eventually) defined here:

class NodeError extends Base {
constructor(...args) {
super(getMessage(code, message, args))
}
toString() {
return `${this.name} [${code}]: ${this.message}`
}
}
Object.defineProperties(NodeError.prototype, {
name: {
value: Base.name,
writable: true,
enumerable: false,
configurable: true
},
toString: {
value() {
return `${this.name} [${code}]: ${this.message}`
},
writable: true,
enumerable: false,
configurable: true
}
})
NodeError.prototype.code = code
NodeError.prototype[kIsNodeError] = true
codes[code] = NodeError
}

In this line, ERR_MULTIPLE_CALLBACK is called instead of constructed:

errorOrDestroy(stream, err !== null && err !== undefined ? err : ERR_MULTIPLE_CALLBACK())

I ran into this in a difficult to isolate scenario

image

@vweevers
Copy link
Contributor

@mcollina
Copy link
Member

@Jarred-Sumner would you like to send a PR? We can't do much about the Node.js source, and we should adapt the code in ours/errors.js to be spawned without new.

A test to repro this would be nice.

@vweevers
Copy link
Contributor

nodejs/node#52110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants