I am using the following code to figure out if there was an error. But I want to not run something if there was an error. I have tried to look it up and I could not find anything about it.
member.roles.remove(role).catch((error) => {
message.reply("I don't have permission to do that!");
});
message.channel.send("Removed role!");
You can do it like this-
member.roles.remove(role).then(() => message.channel.send("Role Removed")).catch(err => message.channel.send("I dont have perms."))
If there will be an error it will not run the code inside .then().