-
-
Notifications
You must be signed in to change notification settings - Fork 4k
chore(Client): robust error checking #9390
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git βοΈ 2 Ignored Deployments
|
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
β¦n/discord.js-fork into chore/robust-errors
β‘οΈ Lighthouse report for the changes in this PR:
Lighthouse ran on https://discord-js-git-fork-tetiewastaken-chore-robust-errors-discordjs.vercel.app/ |
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
e34ef81
to
26f404b
Compare
β¦n/discord.js-fork into chore/robust-errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DiscordjsErrorCodes
needs updating in the typings.
Please describe the changes this PR makes and why it should be merged:
Making this because branch at #9325 was messed up.
π€ Generated by Copilot at ecb068b
Summary
ππ οΈπ«
This pull request improves the error handling and validation of the
Client
constructor and its options. It adds a new custom error typeInvalidScopeWithPermissions
and a corresponding message template for when a bot requests a scope that requires permissions it does not have.Walkthrough
permissions
option is only used withbot
scope inClient
constructor (packages/discord.js/src/client/Client.js
) and throwDiscordjsTypeError
with codeInvalidScopeWithPermissions
if not (link)allowedMentions
,presence
,ws
,rest
, andjsonTransformer
options are of the expected types inClient
constructor (packages/discord.js/src/client/Client.js
) and throwDiscordjsTypeError
with codeClientInvalidOption
if not (link)InvalidScopeWithPermissions
property toErrorCodes
enum (packages/discord.js/src/errors/ErrorCodes.js
) andkeys
array (link, link)InvalidScopeWithPermissions
error code toMessages
object (packages/discord.js/src/errors/Messages.js
) (link)Status and versioning classification: