feat(Rest): optional ratelimit errors (#5659)

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
This commit is contained in:
Ven
2021-06-09 18:45:04 +11:00
committed by GitHub
parent c2b3ed09a0
commit 16f261e773
6 changed files with 145 additions and 7 deletions

View File

@@ -492,6 +492,12 @@ class Client extends BaseClient {
if (typeof options.retryLimit !== 'number' || isNaN(options.retryLimit)) {
throw new TypeError('CLIENT_INVALID_OPTION', 'retryLimit', 'a number');
}
if (
typeof options.rejectOnRateLimit !== 'undefined' &&
!(typeof options.rejectOnRateLimit === 'function' || Array.isArray(options.rejectOnRateLimit))
) {
throw new TypeError('CLIENT_INVALID_OPTION', 'rejectOnRateLimit', 'an array or a function');
}
}
}