fix(@embark/ipfs): fix ipfs upload with wrong error message

This commit is contained in:
Jonathan Rainville 2019-07-12 12:24:12 -04:00
parent 810c3be9fc
commit 27bd574406

View File

@ -34,7 +34,11 @@ class IPFS {
console.debug(cmd); console.debug(cmd);
shelljs.exec(cmd, {silent:true}, function(code, stdout, stderr){ // {silent:true}: don't echo cmd output so it can be controlled via logLevel shelljs.exec(cmd, {silent:true}, function(code, stdout, stderr){ // {silent:true}: don't echo cmd output so it can be controlled via logLevel
console.log(stdout.green); console.log(stdout.green);
callback(stderr, stdout); if (code) {
// stderr can sometimes be an error or the total uploaded size
return callback(stderr || __('IPFS exited with code %s', code.toString()));
}
callback(null, stdout);
}); });
}, },
function getHashFromOutput(result, callback) { function getHashFromOutput(result, callback) {
@ -78,8 +82,7 @@ class IPFS {
} }
], function (err, dir_hash) { ], function (err, dir_hash) {
if (err) { if (err) {
console.log(__("error uploading to ipfs").red); console.error(__("error uploading to ipfs").red);
console.log(err);
cb(err); cb(err);
} }
else cb(null, dir_hash); else cb(null, dir_hash);