gpt4 book ai didi

javascript - 如何阻止错误 'read ECONNRESET' 的发生

转载 作者:行者123 更新时间:2023-11-30 08:20:26 26 4
gpt4 key购买 nike

我制作了很多机器人,一些在我的个人笔记本电脑上,一些在 Heroku 上,但是在这两种情况下,我都收到了终止 node.js 的错误,所以我使用了 bot.on('error ', console.error) 查看错误,结果如下:

type: 'error', message: 'read ECONNRESET', error: {
Error: read ECONNRESET at TLSWrap.onStreamRead(internal / stream_base_commons.js: 111: 27) errno: 'ECONNRESET',
code: 'ECONNRESET',
syscall: 'read'
}

如果有人知道如何阻止这种情况发生,请告诉我。

最佳答案

“ECONNRESET”通常发生在 TCP 连接的另一端由于任何与协议(protocol)相关的错误而关闭其末端时,并且由于没有人正在监听它抛出的“错误”事件,要处理它,您应该放置一个监听器可以处理这种错误情况。

这样的异常处理可以引用这里node-js-best-practice-exception-handling

关于javascript - 如何阻止错误 'read ECONNRESET' 的发生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54408047/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com