Skip to content

Commit

Permalink
优化错误处理
Browse files Browse the repository at this point in the history
  • Loading branch information
bangbang93 committed Apr 10, 2020
1 parent ec4b517 commit 2839995
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ export class Cluster {
})
this.io.on('connect', async () => {
console.log('connected')
await this._enable()
try {
await this._enable()
} catch (e) {
console.error(e)
}
this.isEnabled = true
})
this.io.on('message', (msg) => console.log(msg))
Expand Down Expand Up @@ -199,7 +203,7 @@ export class Cluster {
host: this.host,
port: this.publicPort,
version: this.version,
}, ([err, ack]) => {
}, (err, ack) => {
if (err) return reject(err)
if (ack !== true) return reject(ack)
resolve()
Expand Down

0 comments on commit 2839995

Please sign in to comment.