Skip to content

Commit

Permalink
emit error rather than throw since client is an event emitter
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrugzz committed Mar 24, 2013
1 parent 870439d commit 1d788e7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/godot/net/client.js
Expand Up @@ -166,11 +166,9 @@ Client.prototype.connect = function (port, host, callback) {

function error (arg) {
var err = new Error(arg + ' required to connect');
if (callback) {
return callback(err);
}

throw err;
return callback
? callback(err)
: self.emit('error', err) ;
}

function onError(err) {
Expand Down

0 comments on commit 1d788e7

Please sign in to comment.