Closed System233 closed 2 years ago
Can we add an error handler to catch exceptions from user listeners to ensure that the process does not crash?
If an error
on wechaty
instance has not been caught then the process will crash.
In order to catch it, we can use:
wechaty.on('error', e => {
console.error(e)
})
to catch it.
Please let me know if you have more questions, thank you very much.
LGTM
Please feel free to help yourself to merge this PR when you believe everything is OK with it, thank you very much!
Thanks, I will.
Finally I figured out where
wx2.qq.comundefined
come from: https://github.com/wechaty/puppet-wechat/blob/035e90461aa759b332056db9905bc5a9a4ac14e0/src/wechaty-bro.js#L332-L347 https://github.com/wechaty/webwx-app-tracker/blob/a12c78fb8bd7186c0f3bb0e18dd611151e6b8aac/formatted/webwxApp.js#L2100-L2106 somegetMsgImg
call returnedundefined
andFileBox
requested the url.If I send images one by one and save them, everything is fine, if I sending images too fast, an error will be occurred and crash the process when exception be passed to wechaty.
It should be fixed in #183, but I made a mistake, I thought
$watch
will works like Vue watch API, but it's not, the watch handler will be called immediately in first time even thoughMMStatus
doesn't change.183 should always fail in my manual tests, but it does work, and it should not happen in #184 tests(I think the error cause by the default value of
MMStatus
change to 'SENDING' in #183), which is weird.Other Enhancements
I want to increase the priority of
file.mediaType
to ensure that user behavior is not overwritten https://github.com/wechaty/puppet-wechat/blob/035e90461aa759b332056db9905bc5a9a4ac14e0/src/puppet-wechat.ts#L1245Can we add an error handler to catch exceptions from user listeners to ensure that process dose not crash?