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

Losing the original error message #38

Closed
lmcarreiro opened this issue Apr 22, 2022 · 2 comments · Fixed by #39
Closed

Losing the original error message #38

lmcarreiro opened this issue Apr 22, 2022 · 2 comments · Fixed by #39
Labels

Comments

@lmcarreiro
Copy link

Usually, the javascript error object already have the message property, so this code is overriding the original message that is being lost:

/* istanbul ignore next */
const onUnhandledRejection = (e: any) => {
let error = e;
let reason;
if ('reason' in e) {
reason = e.reason;
} else if (e && e.detail && e.detail.reason) {
reason = e.detail.reason;
}
if (reason instanceof Error) {
error = reason;
} else if (typeof reason === 'string') {
error.message = reason;
} else {
error.message = '<unknown>';
}
error.message = `Uncaught (in promise) ${error.message}`;
captureError(error);
};

image

@TerryMooreII
Copy link
Collaborator

Yep, I will get this fixed up shortly. Thanks for pointing it out.

TerryMooreII added a commit that referenced this issue May 2, 2022
Summary:
Fix bug where unhandledPromiseRejection handler was overwritting
the `error.message` with <unknown>
Fix #38

Semver: patch
TerryMooreII added a commit that referenced this issue May 2, 2022
Summary:
Fix bug where unhandledPromiseRejection handler was overwritting
the `error.message` with <unknown>
Fix #38

Semver: patch
@logdnabot
Copy link
Member

🎉 This issue has been resolved in version 2.0.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

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 a pull request may close this issue.

3 participants