mikeal / sequest

Simplified API for SSH and SFTP similar to request.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

chriskinsman opened this issue · comments

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)

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