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(User): don't generate the banner URL when not cached #6783

Merged
merged 1 commit into from Oct 8, 2021

Conversation

ImRodry
Copy link
Contributor

@ImRodry ImRodry commented Oct 7, 2021

Please describe the changes this PR makes and why it should be merged:
This PR fixes a bug with User#toJSON that would throw an error when the banner wasn't cached. This was changed to make the property undefined instead to allow users to generate the JSON object without this error being thrown as this was quite confusing for some users.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

@iCrawl iCrawl added this to the Version 13.3 milestone Oct 7, 2021
Copy link

@noxzym noxzym left a comment

Choose a reason for hiding this comment

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

image

Why we need to throw error if we can return null like how <Guild>.bannerURL() work?.

@ImRodry
Copy link
Contributor Author

ImRodry commented Oct 7, 2021

Because a null banner means the banner is not set and an undefined banner means it is not cached. In the PR that introduced that I decided to go with the error approach so that users didn't think the user had no banner. Maybe it could've returned undefined, but the PR has already been merged (see #6721)

@iCrawl iCrawl merged commit 0d599a1 into discordjs:main Oct 8, 2021
@ImRodry ImRodry deleted the fix-user-tojson branch October 8, 2021 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants