diff --git a/README.md b/README.md index 508f9ebaf28126e0412fc8d20fb92be6bb0da097..9b6501e54503b5e1e0b91b079043977728a5310c 100644 --- a/README.md +++ b/README.md @@ -204,6 +204,13 @@ You can directly submit pull requests for documentation changes. * [RelatedProject](https://github.com/wechaty/wechaty/wiki/RelatedProject) +# Todo + +* [ ] Use Dependency Injection for FriendRequest(etc) + - https://github.com/young-steveo/bottlejs + - http://jonnyreeves.co.uk/2015/basic-typescript-dependency-injection-with-decorators/ + - https://github.com/connorwyatt/Fluency-Injection + My Story ---------------- My daily life/work depends on too much chat on wechat. diff --git a/example/speech-to-text-bot.ts b/example/speech-to-text-bot.ts index c7e4efc277c7b83f6c2fcf3b71326f7c593bf4a4..6582f234e38d285e27f5823c59256673dbaf8838 100644 --- a/example/speech-to-text-bot.ts +++ b/example/speech-to-text-bot.ts @@ -148,7 +148,7 @@ async function wavToText(readableStream: NodeJS.ReadableStream): Promise try { const obj = JSON.parse(body) if (obj.err_no !== 0) { - return reject(new Error(obj.err_msg)) + throw new Error(obj.err_msg) } return resolve(obj.result[0]) diff --git a/src/puppet-web/event.ts b/src/puppet-web/event.ts index a3a22f3bc3724199d804cf67b4efe90ceba874d9..818a624c1d291995f23608c2da6c9050bf0f2866 100644 --- a/src/puppet-web/event.ts +++ b/src/puppet-web/event.ts @@ -121,11 +121,11 @@ async function onBrowserDead(this: PuppetWeb, e: Error): Promise { log.verbose('PuppetWebEvent', 'onBrowserDead() new browser borned') - // why POISON here... forgot, faint - this.emit('watchdog', { - data: `onBrowserDead() new browser borned` - , type: 'POISON' - }) + // why POISON here... forgot, faint. comment it out to treat dog nicer... 20161128 + // this.emit('watchdog', { + // data: `onBrowserDead() new browser borned` + // , type: 'POISON' + // }) return } diff --git a/test/puppet-web/puppet-web.spec.ts b/test/puppet-web/puppet-web.spec.ts index 4abdfaccf5f53085baafd5bc82b5d296b146c8f9..4228e234682c80cfd8634bde10951898484c32dd 100644 --- a/test/puppet-web/puppet-web.spec.ts +++ b/test/puppet-web/puppet-web.spec.ts @@ -18,7 +18,9 @@ import { Server } from '../../src/puppet-web/server' // import { spy } from 'sinon' process.on('unhandledRejection', (reason, p) => { + console.log('!!!!!!!') console.log('Unhandled Rejection at: Promise', p, 'reason:', reason) + console.log('!!!!!!!') }) /** diff --git a/test/puppet-web/watchdog.spec.ts b/test/puppet-web/watchdog.spec.ts index 8a94e441bdbefcea138e2ff8c1bbe005e7b22be7..56aa3caa6965c74408197305280778ea60750cbc 100644 --- a/test/puppet-web/watchdog.spec.ts +++ b/test/puppet-web/watchdog.spec.ts @@ -20,6 +20,12 @@ import { const PROFILE = 'unit-test-session.wechaty.json' +process.on('unhandledRejection', (reason, p) => { + console.log('!!!!!!!') + console.log('Unhandled Rejection at: Promise', p, 'reason:', reason) + console.log('!!!!!!!') +}) + test('timer', async t => { const pw = new PuppetWeb({profile: PROFILE}) t.truthy(pw, 'should instantiate a PuppetWeb')