MCPcopy Create free account
hub / github.com/mscdex/ssh2 / onerror

Function onerror

lib/protocol/SFTP.js:2227–2252  ·  view source on GitHub ↗
(err)

Source from the content-addressed store, hash-verified

2225 let bufsize = chunkSize * concurrency;
2226
2227 function onerror(err) {
2228 if (hadError)
2229 return;
2230
2231 hadError = true;
2232
2233 let left = 0;
2234 let cbfinal;
2235
2236 if (srcHandle || dstHandle) {
2237 cbfinal = () => {
2238 if (--left === 0)
2239 cb(err);
2240 };
2241 if (srcHandle && (src === fs || src.outgoing.state === 'open'))
2242 ++left;
2243 if (dstHandle && (dst === fs || dst.outgoing.state === 'open'))
2244 ++left;
2245 if (srcHandle && (src === fs || src.outgoing.state === 'open'))
2246 src.close(srcHandle, cbfinal);
2247 if (dstHandle && (dst === fs || dst.outgoing.state === 'open'))
2248 dst.close(dstHandle, cbfinal);
2249 } else {
2250 cb(err);
2251 }
2252 }
2253
2254 src.open(srcPath, 'r', (err, sourceHandle) => {
2255 if (err)

Callers 4

fastXferFunction · 0.85
tryStatFunction · 0.85
onreadFunction · 0.85
writeCbFunction · 0.85

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…