Skip to content Skip to sidebar Skip to footer

Cannot Catch UnhandledPromiseRejectionWarning In Promise

so I'm trying to catch UnhandledPromiseRejectionWarning in my promise, but for some reason it's not working. It ignores my code and just outputs the error to console. Error: Unhan

Solution 1:

You forgot the return statement inside the then function. I suppose message.sendMessage('test') returns a promise

e.message.author.openDM().then((message) => {
    return message.sendMessage(`test`);
}).catch((error) => {
    e.message.channel.sendMessage(error + "test");
});

Post a Comment for "Cannot Catch UnhandledPromiseRejectionWarning In Promise"