From 0b7daad5445bc69413c9b45bcb8754d800ef16c5 Mon Sep 17 00:00:00 2001 From: Paul Varache Date: Thu, 9 Aug 2018 10:27:02 +0100 Subject: [PATCH] Catch erorr, print them --- bin/kart | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bin/kart b/bin/kart index 4dc9767..097b98b 100644 --- a/bin/kart +++ b/bin/kart @@ -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, @@ -79,7 +87,7 @@ function selectProject(opts) { status: s, config: projects[project] }; - }); + }).catch(e => handleError(e)); } function _zeroPad(v) { @@ -224,7 +232,7 @@ function release(argv) { console.log('Aborted'); return; } - }); + }).catch(e => handleError(e)); } function status(argv) { @@ -278,7 +286,7 @@ function archive(argv) { if (argv.release) { return kart.release(build); } - }); + }).catch(e => handleError(e)); } /* Used for testing the UI only */