Open vagishdwivedi opened 6 years ago
throwing error causes whole program to terminate as there's no way to catch it. If you return this error, client program can listen it like: client.ftp.on('error', callback) and act accordingly. Example:
client.connect(function() { console.log('connected to client'); client.upload(request.body.fileName, request.body.uploadPath, { overwrite: 'older' }, function(result) { console.log(result); response.status(200).json(result); }); }); client.ftp.on('error', function(err) { console.log('--- client error: ', err); });
@noodny do you think it should be merged? Throwing error causes whole App to break, if we return then consumer app can handle it robustly.
throwing error causes whole program to terminate as there's no way to catch it. If you return this error, client program can listen it like: client.ftp.on('error', callback) and act accordingly. Example: