提交 3db846ed 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

check return promise from plugin

上级 c6b35e89
......@@ -570,7 +570,10 @@ export class Wechaty extends EventEmitter implements Sayable {
for (const plugin of plugins) {
try {
const future = plugin(this)
if (future) {
/**
* We check `future.catch` at here is to prevent some plugin that return something other than `void`(undefined)
*/
if (future && typeof future.catch === 'function') {
future.catch(e => {
log.error('Wechaty', 'use(%s) rejection: %s',
plugin.name,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册