Skip to content

Throw error instead of using fail method #2536

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

Merged
merged 1 commit into from
Jun 22, 2023

Conversation

robertbrignull
Copy link
Contributor

Should we be using the fail method? We seem to be using it in a few tests to catch incorrect setup, so if everything is correct then this code path doesn't run. But when it does run it appears the fail method isn't defined. See the following error:
Screenshot 2023-06-21 at 16 03 33

I haven't looked deeply into this yet, so I'm not sure if there's something else causing the above failure and maybe we do still want to use fail. But I wonder is there any downside to throwing an exception in any of these cases instead?

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@robertbrignull robertbrignull requested a review from a team June 21, 2023 15:06
@robertbrignull robertbrignull requested a review from a team as a code owner June 21, 2023 15:06
Copy link
Member

@koesie10 koesie10 left a comment

Choose a reason for hiding this comment

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

LGTM, this should be almost equivalent to what fail would have done if it existed. I think the only difference is in helpers-pure.test.ts because it will catch the error, but it should still fail the test since the error message is different.

@robertbrignull robertbrignull merged commit cd69e59 into main Jun 22, 2023
@robertbrignull robertbrignull deleted the robertbrignull/throw-instead-of-fail branch June 22, 2023 10:48
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.

2 participants