diff --git a/lib/docs.js b/lib/docs.js index 70ae3bf29..77f83f21d 100644 --- a/lib/docs.js +++ b/lib/docs.js @@ -40,8 +40,7 @@ exports.run = function({ args, opts }) { function validationErrors(err) { if (err.statusCode === 400) { - console.log(err.error); - return Promise.reject(); + return Promise.reject(err.error); } return Promise.reject(err); diff --git a/rdme.js b/rdme.js index 51a9f59b7..cb70aff55 100755 --- a/rdme.js +++ b/rdme.js @@ -16,7 +16,13 @@ const parseArgs = require('minimist')(process.argv.slice(2), { require('./cli')(parseArgs._[0], parseArgs._.slice(1), parseArgs) .then(() => process.exit()) .catch(err => { - if (err) console.error(err.message.red); - if (err.description) console.warn(err.description); + if (err) { + // `err.message` is from locally thrown Error objects + // `err.error` is from remote API errors + console.error((err.message || err.error).red); + if (err.description) console.warn(err.description); + if (err.errors) console.warn(err.errors); + } + return process.exit(1); });