Skip to content

Commit

Permalink
Merge pull request #3 from KanoComputing/error-display
Browse files Browse the repository at this point in the history
Catch erorr, print them
  • Loading branch information
pazdera authored Aug 9, 2018
2 parents 8d58cb5 + 0b7daad commit 160b5e2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions bin/kart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ const inquirer = require('inquirer'),

updateNotifier({pkg: package}).notify();

function handleError(e) {
if (process.env.DEBUG) {
console.error(e);
} else {
console.log(e.message.red);
}
}

function selectProject(opts) {
let projects,
project,
Expand Down Expand Up @@ -79,7 +87,7 @@ function selectProject(opts) {
status: s,
config: projects[project]
};
});
}).catch(e => handleError(e));
}

function _zeroPad(v) {
Expand Down Expand Up @@ -224,7 +232,7 @@ function release(argv) {
console.log('Aborted');
return;
}
});
}).catch(e => handleError(e));
}

function status(argv) {
Expand Down Expand Up @@ -278,7 +286,7 @@ function archive(argv) {
if (argv.release) {
return kart.release(build);
}
});
}).catch(e => handleError(e));
}

/* Used for testing the UI only */
Expand Down

0 comments on commit 160b5e2

Please sign in to comment.