Skip to content
This repository has been archived by the owner on Dec 20, 2019. It is now read-only.

Commit

Permalink
Suppress unhandled promise rejections on connect
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed May 11, 2016
1 parent 91b5035 commit 75ccac9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/sphero.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Sphero.prototype.connect = function(callback) {
return self.emit.bind(self, name);
}

return new Promise(function (resolve, reject) {
var p = new Promise(function (resolve, reject) {
connection.on("open", function() {
emit("open");
});
Expand Down Expand Up @@ -132,7 +132,10 @@ Sphero.prototype.connect = function(callback) {
self.emit("ready");
resolve();
});
}).asCallback(callback);
});

p.suppressUnhandledRejections();
return p.asCallback(callback);
};


Expand Down

0 comments on commit 75ccac9

Please sign in to comment.