steelbrain / steelbrain/node-ssh

TRY CATCH timeout

Open
#132 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

unconfirmed bug
Dominant language
TypeScript
Stars
1k
Forks
94
PR merge metrics
No merged PRs in 30d

Description

Hi,

How to catch ssh error connexion ?

(node:988) UnhandledPromiseRejectionWarning: Error: Timed out while waiting for handshake at Timeout._onTimeout (/home/dev/www_1/node_modules/ssh2/lib/client.js:687:19) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10) (node:988) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:988) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

also does not work

ssh.on('error', () => {  // Or close, end.
    console.log('ERRO');
})

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the handshake timeout and tracing how the promise from the SSH connection is handled; the report includes the ssh2 path node_modules/ssh2/lib/client.js and an ssh.on('error') attempt. Done means the timeout can be caught without an UnhandledPromiseRejectionWarning, with the relevant behavior covered by an appropriate test if one exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.