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(unhandledPromise): error.message is overwritten #39

Merged
merged 1 commit into from
May 2, 2022

Conversation

TerryMooreII
Copy link
Collaborator

Summary:
Fix bug where unhandledPromiseRejection handler was overwritting
the error.message with
Fix #38

Semver: patch

Summary:
Fix bug where unhandledPromiseRejection handler was overwritting
the `error.message` with <unknown>
Fix #38

Semver: patch
@TerryMooreII TerryMooreII merged commit 72fc396 into main May 2, 2022
@TerryMooreII TerryMooreII deleted the tm/fix-unhandledPromise branch May 2, 2022 18:21
@logdnabot
Copy link
Member

🎉 This PR is included in version 2.0.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

@@ -25,7 +25,7 @@ const addUnhandledrejection = () => {

/* istanbul ignore next */
const onUnhandledRejection = (e: any) => {
let error = e;
let error: any = {};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now sure, but now if one of e.reason or e.detail.reason is a string, even if e instanceof Error, it will lose the stack trace info, because else if (typeof reason === 'string') comes before else if (e instanceof Error).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Losing the original error message
4 participants