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: fixes a bug inside the error reporting #5880

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

lukasholzer
Copy link
Collaborator

🎉 Thanks for submitting a pull request! 🎉

Summary

Fixes an error when a non-error class was reported that it was failing to report the issue.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@lukasholzer lukasholzer requested a review from a team as a code owner July 19, 2023 11:09
@lukasholzer lukasholzer self-assigned this Jul 19, 2023
@github-actions
Copy link

📊 Benchmark results

Comparing with 2c9d8f9

  • Dependency count: 1,299 (no change)
  • Package size: 270 MB ⬇️ 0.01% decrease vs. 2c9d8f9

@@ -25,15 +25,19 @@ export const reportError = async function (error, config = {}) {
return
}

// convert a NotifiableError to an error class
// eslint-disable-next-line unicorn/no-nested-ternary
const err = error instanceof Error ? error : typeof error === 'string' ? new Error(error) : error
Copy link
Member

Choose a reason for hiding this comment

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

The nested ternary does feel odd to me, but deferring to you since it's not a massively complex statement.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

with the right prettier settings it would look pretty good IMHO.

const err = error instanceof Error 
  ? error 
  : typeof error === 'string' 
    ? new Error(error) 
    : error

whereas with if and assignments it's harder to read IMHO but seems like personal preference

@lukasholzer lukasholzer merged commit f38514a into main Jul 19, 2023
@lukasholzer lukasholzer deleted the fix/bugsnag-error-reporting branch July 19, 2023 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants