Please describe the changes this PR makes and why it should be merged:
This PR is an entire @cordis/rest redo.
It adds a bunch of functionality while at it:
A potential stack trace fix for HTTPError
Better retry handling using a single for loop over recursion
Better error handling, accounting for multiple edge cases
A redo of the events on Rest (BREAKING)
The ability to tell the library to not retry after a rate limit, and to instead just throw, which can also be defaulted to all requests on Rest itself
Some tidying around Mutex that will hopefully fix the issues me and some other folks have ran into with rate limiting (breaking; removed the signal parameter)
Better management of AbortController:
You can now do much more when you do pass your own thanks to the changes bellow.
implicitAbortBehavior is a new property on the DiscordFetchOptions interface that controls if the library should set a timeout for the fetch call. It does not have a consistent default. If you do not pass your own controller, it is true, otherwise it will default to false.
Status and versioning classification:
Code changes have been tested against the Discord API, or there are no code changes
This PR changes the library's interface (methods or parameters added)
This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
Will ask @zaida04 to make sure everything is fine in util and everywhere else due to the breaking changes (that are arguably fairly okay on the public APIs we make use of internally) and to do a code review.
Please note that this may or may not lead to new bugs, and if you do upgrade, I'll be working on patching those faster than usual (totally not because I need this working well by May 6th).
Please describe the changes this PR makes and why it should be merged: This PR is an entire
@cordis/rest
redo.It adds a bunch of functionality while at it:
HTTPError
Rest
(BREAKING)Rest
itselfMutex
that will hopefully fix the issues me and some other folks have ran into with rate limiting (breaking; removed the signal parameter)AbortController
:implicitAbortBehavior
is a new property on theDiscordFetchOptions
interface that controls if the library should set a timeout for thefetch
call. It does not have a consistent default. If you do not pass your owncontroller
, it istrue
, otherwise it will default tofalse
.Status and versioning classification:
Will ask @zaida04 to make sure everything is fine in util and everywhere else due to the breaking changes (that are arguably fairly okay on the public APIs we make use of internally) and to do a code review.
Please note that this may or may not lead to new bugs, and if you do upgrade, I'll be working on patching those faster than usual (totally not because I need this working well by May 6th).