improve error handling - print error rather than crash
This commit is contained in:
parent
8d0743a948
commit
cba3487988
2 changed files with 28 additions and 14 deletions
16
bin/copay
16
bin/copay
|
|
@ -19,12 +19,16 @@ var main = function() {
|
|||
|
||||
var args = commander.args;
|
||||
|
||||
copay._command(args[0], args.slice(1), function(err, result) {
|
||||
if (err)
|
||||
return console.log("" + err);
|
||||
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
});
|
||||
try {
|
||||
copay._command(args[0], args.slice(1), function(err, result) {
|
||||
if (err)
|
||||
return console.log("" + err);
|
||||
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
});
|
||||
} catch (err) {
|
||||
console.log("" + err);
|
||||
}
|
||||
};
|
||||
|
||||
if (require.main === module) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue