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

feat(MessageEmbed): remove normalizeField validation #5459

Merged
merged 3 commits into from
May 11, 2021
Merged

feat(MessageEmbed): remove normalizeField validation #5459

merged 3 commits into from
May 11, 2021

Conversation

anandre
Copy link
Contributor

@anandre anandre commented Apr 1, 2021

Please describe the changes this PR makes and why it should be merged:

normalizeField was made with a custom error to throw, this PR removes that so that a proper API error with path will be thrown instead. This makes the error message more informative.

Status and versioning classification:

  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (methods or parameters added)
  • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)

`normalizeField` was made with a custom error to throw, this PR removes that so that a proper API error with path will be thrown instead.  This makes the error message more informative.
@kyranet kyranet requested a review from iCrawl April 30, 2021 12:28
@SpaceEEC
Copy link
Member

How is the location of where you are sending the message more informative than where you are adding the malformed field?

@kyranet
Copy link
Member

kyranet commented May 10, 2021

How is the location of where you are sending the message more informative than where you are adding the malformed field?

We don't really check values in many other places, so why should we do so here?

Copy link
Member

@kyranet kyranet left a comment

Choose a reason for hiding this comment

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

You should remove those two constants, as their only references are removed with this PR:

https://github.com/anandre/discord.js/blob/b70c8bde81bb2b29fa8d08d76a830e68211e270b/src/errors/Messages.js#L40-L41

Removes the constants for empty embed name/values.
@anandre
Copy link
Contributor Author

anandre commented May 10, 2021

Removed.

@anandre anandre closed this May 10, 2021
@anandre anandre reopened this May 10, 2021
@kyranet
Copy link
Member

kyranet commented May 10, 2021

Just one last thing so ESLint passes... this line needs to be removed, now that it's unused:

image

@anandre
Copy link
Contributor Author

anandre commented May 10, 2021

Just one last thing so ESLint passes... this line needs to be removed, now that it's unused:

image

Yup, just saw it and removed the offending line.

@iCrawl iCrawl changed the title Make MessageEmbed#normalizeField better feat(MessageEmbed): remove normalizeField validation May 11, 2021
@iCrawl iCrawl merged commit ff2f737 into discordjs:master May 11, 2021
@iCrawl iCrawl added this to the Version 13 milestone Jun 27, 2021
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.

6 participants