Navigation Menu

Skip to content

Commit

Permalink
Ignore error while processing callback functions when the connection …
Browse files Browse the repository at this point in the history
…is closing
  • Loading branch information
piroor committed Apr 8, 2015
1 parent 634e386 commit e521975
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/droonga-protocol/connection.js
Expand Up @@ -283,8 +283,14 @@ Connection.prototype.close = function() {
Object.keys(this._sendingMessages).forEach(function(id) {
var message = this._sendingMessages[id];
var callback = message.callback;
if (typeof callback == 'function')
callback(ERROR_SERVICE_UNAVAILABLE, null);
if (typeof callback == 'function') {
try {
callback(ERROR_SERVICE_UNAVAILABLE, null);
}
catch(error) {
this._logger.error(error)
}
}
}, this);
this._sendingMessages = {};

Expand Down

0 comments on commit e521975

Please sign in to comment.