Which errors do I have to handle for discord.js functions?
I would expect the docs to tell me which errors a function can throw but I can't find this info in the docs. Am I just blind or can I find this info somewhere else?
9 Replies
yeah, but how do I handle those?
Try catch block and await it
The docs say
Returns: Promise <Message>
So it resolves to a message, but what is the type of the reject?Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Mostly DiscordAPIError
And DJSError
So for example on
Message.delete()
, I can get a DiscordAPIError
for
• The message doesn't exist anymore
• The bot user doesn't have permission to delete the message
• ???
Is anywhere documented what can go wrong?No, Discord doesn’t document that
damn
ok thanks
Make your commands be executed within a try/catch block via a command handler that’ll aggregate all errors