Skip to content

Commit

Permalink
Handle upload errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bancek committed Nov 28, 2012
1 parent 5fb6cd7 commit 76b42dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions lib/jsftp.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,14 @@ Ftp.getPasvPort = function(text) {
called = true;
callback(err, socket);
} else {
if (!Ftp.isMark(res.code) && doneCallback) {
doneCallback(res)
if (doneCallback) {
if (err) {
doneCallback(err)
} else {
if (!Ftp.isMark(res.code)) {
doneCallback(err, res)
}
}
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions test/jsftp_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ describe("jsftp test suite", function() {

socket.end();
});
}, function(res) {
}, function(err, res) {
assert.equal(res.code, 226);

ftp.raw.dele(remotePath, function(err, data) {
Expand All @@ -330,7 +330,7 @@ describe("jsftp test suite", function() {
assert.ok(err, err);
assert.equal(err.code, 550);
next();
}, function(res) {
}, function(err, res) {
assert.ok(false);
});
});
Expand Down

0 comments on commit 76b42dc

Please sign in to comment.