discord.js捕获到Promise错误后返回?

尝试使之工作:

try{
   message.author.send(helpEmbed)
}
catch(error) {
   message.channel.send("Your dms are closed,cannot send help message.")
   return;
}
message.react('✅')

但是catch(error)对于承诺错误不起作用(因为实际错误日志将其称为“ UnhandledPromiseRejectionWarning”)。而且我不能使用.catch(()=> etc,因为那样我就不能在其中放一个return,这意味着它不会停止该消息。在try / catch中,您不能离开该消息。 catch()为空。

dmkut 回答:discord.js捕获到Promise错误后返回?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3148035.html

大家都在问