Commit 2b2afd55 authored by Erik Schwartz's avatar Erik Schwartz 🉐
Browse files

Handle error emitted

parent 00a430e1
......@@ -27,7 +27,7 @@ function downloadFile(sshOpt, remoteFile, localFile, callback) {
ssh.on('ready', () => {
ssh.sftp((err, sftp) => {
if (err) {
console.error('Problem setting up SFTP session');
console.error('Problem starting SFTP session');
return callback(err);
}
sftp.exists(remoteFile, (doesExist) => {
......@@ -49,6 +49,10 @@ function downloadFile(sshOpt, remoteFile, localFile, callback) {
});
});
}).connect(sshOpt);
ssh.on('error', (err) => {
console.error('Problem connecting to SSH server');
return callback(err);
});
}
// -------------------------------------------------------------------------
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment