crash even if I have a trycatch

The bot crashes even if I put a trycatch(error).
6 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Aiwoz[old]
Aiwoz[old]OP7mo ago
Command handler :
try {
member.setNickname(newNickname);
} catch (error) {
console.error( error);
}
try {
member.setNickname(newNickname);
} catch (error) {
console.error( error);
}
Error :
C:\Users\Aiwoz\Desktop\Bot Discord\Bot-Aiwoz\node_modules\@discordjs\rest\dist\index.js:722
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50013]: Missing Permissions
at handleErrors (C:\Users\Aiwoz\Desktop\Bot Discord\Bot-Aiwoz\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\Aiwoz\Desktop\Bot Discord\Bot-Aiwoz\node_modules\@discordjs\rest\dist\index.js:1120:23)
at async SequentialHandler.queueRequest (C:\Users\Aiwoz\Desktop\Bot Discord\Bot-Aiwoz\node_modules\@discordjs\rest\dist\index.js:953:14)
at async _REST.request (C:\Users\Aiwoz\Desktop\Bot Discord\Bot-Aiwoz\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async GuildMemberManager.edit (C:\Users\Aiwoz\Desktop\Bot Discord\Bot-Aiwoz\node_modules\discord.js\src\managers\GuildMemberManager.js:381:15) {
requestBody: { files: undefined, json: { nick: 'Test' } },
rawError: { message: 'Missing Permissions', code: 50013 },
code: 50013,
status: 403,
method: 'PATCH',
url: 'https://discord.com/api/v10/guilds/1187082722401861765/members/693160609398653010'
}

Node.js v20.11.1
C:\Users\Aiwoz\Desktop\Bot Discord\Bot-Aiwoz\node_modules\@discordjs\rest\dist\index.js:722
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50013]: Missing Permissions
at handleErrors (C:\Users\Aiwoz\Desktop\Bot Discord\Bot-Aiwoz\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\Aiwoz\Desktop\Bot Discord\Bot-Aiwoz\node_modules\@discordjs\rest\dist\index.js:1120:23)
at async SequentialHandler.queueRequest (C:\Users\Aiwoz\Desktop\Bot Discord\Bot-Aiwoz\node_modules\@discordjs\rest\dist\index.js:953:14)
at async _REST.request (C:\Users\Aiwoz\Desktop\Bot Discord\Bot-Aiwoz\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async GuildMemberManager.edit (C:\Users\Aiwoz\Desktop\Bot Discord\Bot-Aiwoz\node_modules\discord.js\src\managers\GuildMemberManager.js:381:15) {
requestBody: { files: undefined, json: { nick: 'Test' } },
rawError: { message: 'Missing Permissions', code: 50013 },
code: 50013,
status: 403,
method: 'PATCH',
url: 'https://discord.com/api/v10/guilds/1187082722401861765/members/693160609398653010'
}

Node.js v20.11.1
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Aiwoz[old]
Aiwoz[old]OP7mo ago
Okay and if I want an error for all events, I put await in the event handler?
No description
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Aiwoz[old]
Aiwoz[old]OP7mo ago
Thank you. ^^
Want results from more Discord servers?
Add your server