-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
upgrade socket & clientError #20477
Copy link
Copy link
Closed
Labels
httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.questionIssues that look for answers.Issues that look for answers.
Metadata
Metadata
Assignees
Labels
httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.questionIssues that look for answers.Issues that look for answers.
Type
Fields
Give feedbackNo fields configured for issues without a type.
When handling a
on('request', (req, res) => {})on does not have to add listener for theerrorevents onreqandressince any errors will be forwarded toclientError.However, when doing
on('upgrade', (req, socket, head) => {}),socketcan emit an error which might be uncaugth. On common way to implementupgradeis:However, the problem with the above is that it might crash the server if the callback is called with an error and either
socket.endorsocket.destroyis called and an error is emitted afterward. In such a case shouldn't forward the error toclientErrorautomatically for the user?