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

more log & code clean

上级 9c825a72
......@@ -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.
......
......@@ -148,7 +148,7 @@ async function wavToText(readableStream: NodeJS.ReadableStream): Promise<string>
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])
......
......@@ -121,11 +121,11 @@ async function onBrowserDead(this: PuppetWeb, e: Error): Promise<void> {
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
}
......
......@@ -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('!!!!!!!')
})
/**
......
......@@ -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')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册