Skip to content

Commit

Permalink
Try to stringify message errors so socket errors keep their data. (de…
Browse files Browse the repository at this point in the history
  • Loading branch information
SejH committed Jul 27, 2017
1 parent 29831ba commit 601b253
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 601b253

Please sign in to comment.