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

Raise error in utils.get_or_fetch if a default value is not passed #339

Merged

Conversation

BobDotCom
Copy link
Member

Summary

Adds a raise_exc kwarg to utils.get_or_fetch. If True, it raises instead of returning the default value.
Moved from #338

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, typehinting, ...)

ImNimboss
ImNimboss previously approved these changes Oct 27, 2021
Copy link
Member Author

@BobDotCom BobDotCom left a comment

Choose a reason for hiding this comment

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

An alternative solution, and personally one I prefer. It does introduce breaking changes though, but that shouldn't be an issue as breaking changes are expected in major version increments. This raises if default is not supplied.

discord/utils.py Outdated Show resolved Hide resolved
discord/utils.py Outdated Show resolved Hide resolved
@BobDotCom BobDotCom changed the title add raise_exc kwarg to utils.get_or_fetch Raise error in utils.get_or_fetch if a default value is not passed Oct 28, 2021
@Lulalaby Lulalaby added feature request New feature request priority: medium Medium Priority status: awaiting review Awaiting review from a maintainer feature Implements a feature and removed feature request New feature request labels Oct 30, 2021
@BobDotCom BobDotCom merged commit f70921a into Pycord-Development:master Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Implements a feature priority: medium Medium Priority status: awaiting review Awaiting review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants