Permalink
Browse files

Fix error handling

  • Loading branch information...
1 parent 3dbb201 commit 80d26a9f6dcd4ff47cf2e4751680c85df9909457 @kriszyp committed Dec 28, 2010
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/model/git.js
View
@@ -8,6 +8,7 @@ exports.queryRepo = function(repo){// repo is like kriszyp/pintura
var connection = require("net").createConnection(9418, "github.com"),
deferred = defer();
var response = "";
+
connection.on("data", function(data){
var versions = [];
response += data.toString();
@@ -27,8 +28,11 @@ exports.queryRepo = function(repo){// repo is like kriszyp/pintura
command = new Array(5 - length.length).join("0") + length + command;
connection.write(command);
});
- connection.on("error ", function(error){
- deferred.reject(error)
+ connection.on("error", function(error){
+ deferred.reject(error);
+ });
+ connection.on("timeout", function(error){
+ deferred.reject(error);
});
return deferred.promise;
}

0 comments on commit 80d26a9

Please sign in to comment.