channel.send(embed).then(m => {
m.react("<:check:947079937372872704>")
m.react("<:warning:943421375526355024>")
}).catch(err => {
message.channel.send('Error')
})
This is my code but when the bot doesn't have add reaction perms it crashes instead of catching it and printing Error
The problem is that you have two promises inside your then block that don't return anything as a whole. This means that your catch block won't catch anything because there is nothing to catch.
If you remove one of the reactions and tweak it a bit then it will work as expected.
.then((m) => m.react("✅"))
Note that this implicitly returns the promise created by m.react("✅"), which can then conditionally be caught by your catch block.
So the natural question is how do you add these reactions while still keeping the structure?
One solution is to use Promise.all()
.then((m) => Promise.all([m.react("✅"), m.react("⚠️")]))
In short, it takes an array of promises and attempts to resolve them. If all goes well it returns an array of the resolved values. If there is an error it will return the first error it encounters.
Hope this helped!