Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Break on uncaught exceptions does not work with 'error' events in domains #5962

@bajtos

Description

@bajtos

Consider the following code (uncomment one of the lines (1) or (2)):

var domain = require('domain');
var http = require('http');
var EventEmitter = require('events').EventEmitter;

var d = domain.create();
d.on('error', function(err) {
  console.log('unhandled error', err);
  process.exit(1);
});

d.run(function() {
  http.createServer(function(req, res) {
      // throw new Error('uncaught throw'); // (1)
      // new EventEmitter().emit('error', new Error('uncaught event')); // (2)
      }).listen(3000);
});

When running in a debugger, the first statement (1) breaks on uncaught exception but the second (2) does not.

When the server is not running inside a domain, both (1) and (2) breaks on uncaught exception in V8 debugger.

See PR #5713 for the implementation of "break on uncaught exception" (v0.11 only).

Metadata

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