mikeal / sequest

Simplified API for SSH and SFTP similar to request.
283 stars 24 forks source link

Error thrown when .on('error', func) specified #38

Closed chriskinsman closed 8 years ago

chriskinsman commented 8 years ago

I am hitting an issue where I get an error thrown in stream mode even though I have an error handler hooked up

    var writeStream = sequest.put(_sftpUser + '@' + _sftpServer, _sftpPrefix + filename, {
        password: _sftpPassword,
        port: 8442
    });

    writeStream.once('error', function (err) {
        logger.error(err);
        return callback(err);
    });

Error received is:

Error: Timed out while waiting for handshake at null._onTimeout (/Users/chris/projects/PushSpring/server/ps-common/node_modules/sequest/node_modules/ssh2/lib/Connection.js:232:17) at Timer.listOnTimeout (timers.js:92:15)

chriskinsman commented 8 years ago

Figure out issue. That puts an error handler on the stream not the underlying ssh2 connection.

SequestPut() somehow misses doing this which allows the uncatchable exception to get thrown down in ssh2.

Pull request forthcoming