openwechat icon indicating copy to clipboard operation
openwechat copied to clipboard

如何catch panic error

Open lucasjinreal opened this issue 3 years ago • 7 comments

目前似乎在运行过程中,偶尔会发生panic error,尚不知道为何原因产生,有什么办法可以catch这个panic,一旦发生就pass,继续运行啊

lucasjinreal avatar Sep 13 '22 06:09 lucasjinreal

panic是默认行为,重载这个默认行为即可。 需要对Bot的MessageErrorHandler重新赋值。

JinTian @.***> 于2022年9月13日周二 14:40写道:

目前似乎在运行过程中,偶尔会发生panic error,尚不知道为何原因产生,有什么办法可以catch这个panic,一旦发生就pass,继续运行啊

— Reply to this email directly, view it on GitHub https://github.com/eatmoreapple/openwechat/issues/106, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARP5DT5ZBT4GRDJ2SG4NWKTV6AOWPANCNFSM6AAAAAAQLDSPJI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

eatmoreapple avatar Sep 13 '22 06:09 eatmoreapple

image

理论上我已经设置了,蛋还是会panic

lucasjinreal avatar Sep 13 '22 08:09 lucasjinreal

能追踪到是哪行代码吗?

eatmoreapple avatar Sep 13 '22 10:09 eatmoreapple

image

zh这是log,大佬请分析一下

lucasjinreal avatar Sep 13 '22 11:09 lucasjinreal

会是我这行代码造成的吗? image

lucasjinreal avatar Sep 13 '22 11:09 lucasjinreal

没有处理err,看看error

eatmoreapple avatar Sep 14 '22 02:09 eatmoreapple

thankyou good

xiaotuzididi avatar Dec 12 '22 07:12 xiaotuzididi