ApiError
- class ApiError
A Discord API request that failed. SDK methods that call Discord throw this. Methods typed to return
nullreturn it for a 404 instead of throwing.try { await member.ban(); } catch (error) { if (error instanceof discord.ApiError && error.status === 403) { await message.reply("I don't have permission to ban them."); } else { throw error; } }
- Extends:
Error
Properties
Property
Type
Description
codeDiscord’s JSON error code, or
0when Discord didn’t send one.name“ApiError”
retryAfterSeconds to wait before retrying, for a 429 response.
nullotherwise.statusHTTP status Discord answered with, such as 403 or 404.