Skip to content

Commit

Permalink
Try to stringify message errors so socket errors keep their data. (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
SejH authored and jdmnd committed Jul 3, 2017
1 parent f638abe commit 0623cec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/message/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,11 @@ Connection.prototype._onError = function (error) {
if (error.code === 'ECONNRESET' || error.code === 'ECONNREFUSED') {
msg = `Can't connect! Deepstream server unreachable on ${this._originalUrl}`
} else {
msg = error.toString()
try {
msg = JSON.stringify(error)
} catch(e) {
msg = error.toString()
}
}
this._client._$onError(C.TOPIC.CONNECTION, C.EVENT.CONNECTION_ERROR, msg)
}, 1)
Expand Down

0 comments on commit 0623cec

Please sign in to comment.