-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src,http: fix uncaughtException miss in http
If the call to MakeCallback is currently in_makecallback() then return the empty handle instead of Undefined. This allows the error to propagate through multiple MakeCallback calls.
- Loading branch information
1 parent
01c331e
commit cd62963
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const http = require('http'); | ||
|
||
const uncaughtCallback = common.mustCall(function(er) { | ||
assert.equal(er.message, 'get did fail'); | ||
}); | ||
|
||
process.on('uncaughtException', uncaughtCallback); | ||
|
||
const server = http.createServer(function(req, res) { | ||
res.writeHead(200, { 'Content-Type': 'text/plain' }); | ||
res.end('bye'); | ||
}).listen(common.PORT, function() { | ||
http.get({ port: common.PORT }, function(res) { | ||
res.resume(); | ||
throw new Error('get did fail'); | ||
}).on('close', function() { | ||
server.close(); | ||
}); | ||
}); |