Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't double-log unhandled rejections #37464

Merged
merged 1 commit into from
Mar 6, 2023
Merged

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Mar 1, 2023

Description of Change

Closes #36829.

Switches from unhandled rejection style from warn to warn-with-error-code. The warn mode always triggers a warning, no matter if the unhandledRejection hook is set or not - this isn't really intuitive behavior. We added this initially in #29244, because Node.js themselves switched their unhandled rejection behavior to throw by default and we didn't want unhandled rejections to crash the main or renderer processes. warn-with-error-code now only warns if the error is not handled with the unhandledRejection hook - it also sets the process exit code to 1, but this doesn't affect Electron as it sets its own exit code.

Checklist

Release Notes

Notes: Fixed an issue where unhandled rejections could cause duplicate logs in some cases.

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/22-x-y PR should also be added to the "22-x-y" branch. target/23-x-y PR should also be added to the "23-x-y" branch. target/24-x-y PR should also be added to the "24-x-y" branch. labels Mar 1, 2023
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Mar 1, 2023
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Mar 2, 2023
@codebytere codebytere merged commit 829fb4f into main Mar 6, 2023
@codebytere codebytere deleted the use-warn-with-code branch March 6, 2023 10:04
@release-clerk
Copy link

release-clerk bot commented Mar 6, 2023

Release Notes Persisted

Fixed an issue where unhandled rejections could cause duplicate logs in some cases.

@trop
Copy link
Contributor

trop bot commented Mar 6, 2023

I have automatically backported this PR to "24-x-y", please check out #37500

@trop trop bot added in-flight/24-x-y and removed target/24-x-y PR should also be added to the "24-x-y" branch. labels Mar 6, 2023
@trop
Copy link
Contributor

trop bot commented Mar 6, 2023

I have automatically backported this PR to "23-x-y", please check out #37501

@trop
Copy link
Contributor

trop bot commented Mar 6, 2023

I have automatically backported this PR to "22-x-y", please check out #37502

@trop trop bot added in-flight/23-x-y merged/24-x-y PR was merged to the "24-x-y" branch merged/22-x-y PR was merged to the "22-x-y" branch. and removed target/23-x-y PR should also be added to the "23-x-y" branch. target/22-x-y PR should also be added to the "22-x-y" branch. in-flight/24-x-y labels Mar 6, 2023
@trop trop bot added merged/23-x-y PR was merged to the "23-x-y" branch. and removed in-flight/23-x-y labels Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged/22-x-y PR was merged to the "22-x-y" branch. merged/23-x-y PR was merged to the "23-x-y" branch. merged/24-x-y PR was merged to the "24-x-y" branch semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: When logging unhandled rejection stack, stack is logged twice
2 participants