GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 'uncaughtException' event not working with unhandled promises · Issue #32907 · nodejs/node

'uncaughtException' event not working with unhandled promises #32907

New issue
Copy link
New issue
Copy link
Closed
Closed
'uncaughtException' event not working with unhandled promises#32907
Copy link
Labels
docIssues and PRs related to Node.js documentation.

Description

@MrBartusek
MrBartusek
opened on Apr 17, 2020
Issue body actions
  • Version: 13.3.0
  • Platform: Win 10 64-bit
  • Subsystem: Process

What steps will reproduce the bug?

process.on('uncaughtException', (err, origin) =>
{
	console.log('catch: ' + err.message + ' | ' + origin);
	console.log();
});

examplePromise();

function examplePromise()
{
	return Promise.reject('Test');
}

What is the expected behavior?

According to the documentation default node handling should be overwritten by this callback with unhandledRejection origin

What do you see instead?

(node:14784) UnhandledPromiseRejectionWarning: Test
(node:14784) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14784) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Additional information

I think that is probably an error that documentation and origin variable suggests that uncaughtException can handle promises when we have unhandledRejection event.

Activity

  1. cjihrig commented on Apr 17, 2020

    @cjihrig
    cjihrig
    on Apr 17, 2020
    Contributor
    More actions

    You have an unhandled rejection, not an uncaught exception. They aren't the same thing. You could try looking into the --unhandled-rejections CLI flag though. The strict mode should do what you want.

  2. cjihrig commented on Apr 17, 2020

    @cjihrig
    cjihrig
    on Apr 17, 2020
    Contributor
    More actions

    FWIW, I just read through the docs, and I agree that they are confusing in this regard.

    Reacted by Michaël Zasso, Mark and Brent Williams
  3. MrBartusek commented on May 1, 2020

    @MrBartusek
    MrBartusek
    on May 1, 2020
    Author
    More actions

    I see that this issue is inactive so to work on any fix the more information are needed:

    1. What is the purpose of origin?
    2. Why according to documentation there are two ways to handle the same thing unhandledRejection (origin argument) and unhandledRejection (event)
    3. Is that documentation issue or codebase issue?
    Reacted by Mark
  4. BridgeAR
    added
    docIssues and PRs related to Node.js documentation.
    on May 23, 2020
  5. BridgeAR
    added a commit that references this issue on May 23, 2020

    doc: outline when origin is set to unhandledRejection

    d9dcabb
  6. BridgeAR commented on May 25, 2020

    @BridgeAR
    BridgeAR
    on May 25, 2020
    Member
    More actions

    @MrBartusek I opened #33530 to improve the documentation. Does that clarify the origin argument and the purpose of it?

  7. MrBartusek commented on May 25, 2020

    @MrBartusek
    MrBartusek
    on May 25, 2020
    Author
    More actions

    @BridgeAR Yes! That clarifies everything, thanks

  8. BridgeAR
    added a commit that references this issue on May 30, 2020

    doc: outline when origin is set to unhandledRejection

    f762686
  9. BridgeAR
    closed this as completedin f762686on May 30, 2020
  10. codebytere
    added a commit that references this issue on Jun 18, 2020

    doc: outline when origin is set to unhandledRejection

    352adcb
  11. codebytere
    added a commit that references this issue on Jun 30, 2020

    doc: outline when origin is set to unhandledRejection

    e02eb8a
  12. codebytere
    added a commit that references this issue on Jul 8, 2020

    doc: outline when origin is set to unhandledRejection

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.