Skip to content

uncaughtException not called with http.get() #5555

Closed
@martinkuba

Description

  • Version: v5.7.1
  • Platform: Darwin 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
  • Subsystem: http, errors

With the following example, I would expect uncaughtException to be triggered. It works on v4.x but not on latest v5.

var http = require('http')

process.once('uncaughtException', function(error) {
  console.log('in uncaughtException')
  console.log(error)
})

server = http.createServer(function(req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'})
  res.end('some data')
})

server.listen(8183, function () {
  http.get('http://localhost:8183', function (res) {
    console.log('got response')
    res.resume()

    // throwing error here to trigger uncaughtException
    throw new Error("some error")
  })
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    httpIssues or PRs related to the http subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions