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(SequentialHandler): throw http error with proper name and more useful message #8694

Merged

Conversation

SpaceEEC
Copy link
Member

@SpaceEEC SpaceEEC commented Oct 1, 2022

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

This PR fixes #8615 by overwriting the error of HTTPError with the name of the class (as I think is how sub-classed errors should generally work) and synthesizing an error message based on the http status (as undici apparently does not expose the status text?).

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

@vercel
Copy link

vercel bot commented Oct 1, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
discord-js ⬜️ Ignored (Inspect) Oct 1, 2022 at 2:44PM (UTC)

@codecov
Copy link

codecov bot commented Oct 1, 2022

Codecov Report

Merging #8694 (4e3d4cd) into main (c69f512) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #8694      +/-   ##
==========================================
+ Coverage   86.79%   86.82%   +0.02%     
==========================================
  Files          85       84       -1     
  Lines        8777     8787      +10     
  Branches     1109     1107       -2     
==========================================
+ Hits         7618     7629      +11     
+ Misses       1117     1116       -1     
  Partials       42       42              
Flag Coverage Δ
builders 100.00% <ø> (ø)
collection 100.00% <ø> (ø)
proxy 81.53% <100.00%> (+1.06%) ⬆️
rest 92.09% <100.00%> (+0.07%) ⬆️
utilities ?
voice 63.83% <ø> (ø)
ws 60.47% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/proxy/src/handlers/proxyRequests.ts 73.91% <100.00%> (+2.27%) ⬆️
packages/rest/src/lib/RequestManager.ts 90.34% <100.00%> (+0.09%) ⬆️
packages/rest/src/lib/errors/HTTPError.ts 100.00% <100.00%> (ø)
...ackages/rest/src/lib/handlers/SequentialHandler.ts 86.44% <100.00%> (+0.41%) ⬆️
packages/actions/src/formatTag/formatTag.ts

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kodiakhq kodiakhq bot merged commit 3f86561 into discordjs:main Oct 1, 2022
@Jiralite Jiralite added this to the rest v1.3 milestone Oct 1, 2022
@SpaceEEC SpaceEEC deleted the fix/rest/http_error/name_and_message branch October 5, 2022 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Error name is "Object" (incorrectly cast from an Object) instead of a sensible descriptive string
5 participants