Hi!
I'm currently having a bit of trouble concerning my upload function :
client.on('error', function(err) {
return res.status(500).json({
message: 'Error when sending image to media server',
error: err
});
});
client.upload(req.file.path, '/home2/myhome/'+image.storedName, function (err) {
if (err) {
return res.status(500).json({
message: 'Error when sending image to media server',
error: err
});
}
image.fullUrl = config.mediaURL + image.storedName;
image.save(function (err, image) {
if (err) {
return res.status(500).json({
message: 'Error when saving image',
error: err
});
}
return res.status(201).send();
});
});
If the destination file is incorrect or my permissions are wrong I get this error :
/Users/Nicolas/Documents/Davidson/Adeo/Mobility/feedback-product/node_modules/ssh2-streams/lib/sftp.js:878 throw new Error('handle is not a Buffer');
Am I missing something, or is ssh2-streams not managing the error correctly ? (As far as I know you're not supposed to throw errors in async functions in NodeJs, only return them)
Hi! I'm currently having a bit of trouble concerning my upload function :
If the destination file is incorrect or my permissions are wrong I get this error :
/Users/Nicolas/Documents/Davidson/Adeo/Mobility/feedback-product/node_modules/ssh2-streams/lib/sftp.js:878 throw new Error('handle is not a Buffer');
Am I missing something, or is ssh2-streams not managing the error correctly ? (As far as I know you're not supposed to throw errors in async functions in NodeJs, only return them)