Skip to content

Domain is pinned to rejected Promise, but domain is not caught #831

Closed
@ORESoftware

Description

@ORESoftware

Using this code:

const Domain = require('domain');
const d = Domain.create();

process.once('unhandledRejection', function(r, p){
  console.log('unhandledRejection', r, p);
});

d.once('error', function(){
  console.log('domain caught');
});


d.run(function(){
  Promise.resolve(null).then(function(){
    throw 'foo';
  });
});

the domain error event handler won't be touched -> the exception will be sent to the unhandledRejection handler, but the promise will have the domain instance pinned to it. I assume this is expected behavior, but since we have the domain, why not fire it's error event instead of firing unhandledRejection?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions