Skip to content

Unhandled promise rejection with throwing toString crashes node #13771

Description

@bakkot
  • Version: 8.1.2
$ node
> Promise.reject({toString(){throw 42;}})
Promise {
  <rejected> { toString: [Function: toString] },
  domain:
   Domain {
     domain: null,
     _events: { error: [Function: debugDomainError] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] } }
>
repl:1
Promise.reject({toString(){throw 42;}})
                           ^
42

$

This is approximately the same issue as #11637. The fix, in #11640, dealt with only that case, not the full problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    promisesIssues and PRs related to ECMAScript promises.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions