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

clean(code): format

上级 6458a29c
......@@ -222,20 +222,23 @@ export class Bridge {
})
}
public verifyUserRequest(contactId, hello): Promise<boolean> {
public async verifyUserRequest(contactId, hello): Promise<boolean> {
log.verbose('PuppetWebBridge', 'verifyUserRequest(%s, %s)', contactId, hello)
if (!contactId) {
throw new Error('no valid contactId')
}
return this.proxyWechaty('verifyUserRequestAsync', contactId, hello)
.catch(e => {
log.error('PuppetWebBridge', 'verifyUserRequest(%s, %s) exception: %s', contactId, hello, e.message)
throw e
})
try {
return await this.proxyWechaty('verifyUserRequestAsync', contactId, hello)
} catch (e) {
log.error('PuppetWebBridge', 'verifyUserRequest(%s, %s) exception: %s', contactId, hello, e.message)
throw e
}
}
public verifyUserOk(contactId, ticket): Promise<boolean> {
public async verifyUserOk(contactId, ticket): Promise<boolean> {
log.verbose('PuppetWebBridge', 'verifyUserOk(%s, %s)', contactId, ticket)
if (!contactId || !ticket) {
......@@ -248,7 +251,7 @@ export class Bridge {
})
}
public send(toUserName: string, content: string): Promise<boolean> {
public async send(toUserName: string, content: string): Promise<boolean> {
if (!toUserName) {
throw new Error('UserName not found')
}
......
......@@ -19,7 +19,7 @@
/* tslint:disable:no-var-requires */
const retryPromise = require('retry-promise').default
import Contact from '../contact'
import { Contact } from '../contact'
import {
Config,
RecommendInfo,
......
......@@ -652,7 +652,7 @@ export class PuppetWeb extends Puppet {
*/
public async friendRequestSend(contact: Contact, hello: string): Promise<boolean> {
if (!this.bridge) {
return Promise.reject(new Error('fail: no bridge(yet)!'))
throw new Error('fail: no bridge(yet)!')
}
if (!contact) {
......
......@@ -756,8 +756,8 @@
VerifyContent = VerifyContent || '';
var contactFactory = WechatyBro.glue.contactFactory
var confFactory = WechatyBro.glue.confFactory
var contactFactory = WechatyBro.glue.contactFactory
var confFactory = WechatyBro.glue.confFactory
var Ticket = '' // what's this?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册