Skip to content

Commit 848d119

Browse files
committed
fix: catch error
1 parent e9bf58a commit 848d119

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/message/connection.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -249,20 +249,20 @@ Connection.prototype._recvMessages = function (deadline) {
249249
continue
250250
}
251251

252-
if (this._logger) {
253-
this._logger.trace(message, 'receive')
254-
}
255-
256-
messageParser.parseMessage(message, this._client, this._message)
257-
258-
this.emit('recv', this._message)
259-
260-
if (this._message.topic === C.TOPIC.CONNECTION) {
261-
this._handleConnectionResponse(this._message)
262-
} else if (this._message.topic === C.TOPIC.AUTH) {
263-
this._handleAuthResponse(this._message)
264-
} else {
265-
this._client._$onMessage(this._message)
252+
try {
253+
messageParser.parseMessage(message, this._client, this._message)
254+
255+
this.emit('recv', this._message)
256+
257+
if (this._message.topic === C.TOPIC.CONNECTION) {
258+
this._handleConnectionResponse(this._message)
259+
} else if (this._message.topic === C.TOPIC.AUTH) {
260+
this._handleAuthResponse(this._message)
261+
} else {
262+
this._client._$onMessage(this._message)
263+
}
264+
} catch (err) {
265+
this._onError(err)
266266
}
267267
}
268268

0 commit comments

Comments
 (0)