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(BitField): add problematic bit to error #4617

Merged
merged 3 commits into from
Aug 12, 2020

Conversation

almostSouji
Copy link
Member

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

Provide the offending bitflag to the BITFIELD_INVALID error for easier debugging

Status

  • 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

Semantic versioning classification:

  • This PR changes the library's interface (methods or parameters added)
    • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
  • This PR only includes non-code changes, like changes to documentation, README, etc.

@almostSouji almostSouji changed the title chore: provide bit on BITFIELD_INVALID feat(BitField): add problematic bit to error Jul 6, 2020
@almostSouji
Copy link
Member Author

Switched to a different approach to avoid semver major

@iCrawl iCrawl requested a review from SpaceEEC July 17, 2020 08:19
@papaia
Copy link
Contributor

papaia commented Jul 17, 2020

This is still undocumented and un-typed.

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.

I think it might be worth to mention that this RangeError has an extra property of bit, but otherwise LGTM.

@almostSouji
Copy link
Member Author

I really think documenting this is out of the scope of what a minor can do. Yes, we could put a note in the #resolve jsdocs, though I really don't see much benefit in that, seeing that the only purpose of this method is to internally validate bit flags. If they know of resolve they're likely reading source code anyways and will see the bit property.

The more surfacing approach would be to bubble the documentation to the methods users might actually use, however that's 1) a lot and 2) would be rather inconsistent with other parts of our documentation where we choose to not overload jsdocs with a bunch of notes.

I can not find any way to document or type this in a way so it may be useful for the user.

As is proposed this will serve as additional hint for both our support flow (not having to read a ton of code in order to find the offending flag name) as well as users that properly handle their promise rejections and log full errors.

@iCrawl iCrawl merged commit 0225851 into discordjs:master Aug 12, 2020
@almostSouji almostSouji deleted the bitflag-error branch September 27, 2020 10:39
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.

5 participants