Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[fix] Change callback order in error handling

  • Loading branch information...
commit b6d7d41e7c62e391a829681935f5c6cbc0d4dcb4 1 parent 478e96d
@julianduque julianduque authored
Showing with 16 additions and 16 deletions.
  1. +16 −16 lib/jitsu.js
View
32 lib/jitsu.js
@@ -35,7 +35,7 @@ jitsu.use(flatiron.plugins.cli, {
string: true
},
jitsuconf: {
- alias: 'j',
+ alias: 'j',
description: 'specify file to load configuration from',
string: true
},
@@ -76,7 +76,7 @@ jitsu.options.log = {
// Setup config, users, command aliases and prompt settings
//
jitsu.prompt.properties = flatiron.common.mixin(
- jitsu.prompt.properties,
+ jitsu.prompt.properties,
require('./jitsu/properties')
);
jitsu.prompt.override = jitsu.argv;
@@ -124,7 +124,7 @@ jitsu.welcome = function () {
// #### @callback {function} Continuation to pass control to when complete.
// Starts the jitsu CLI and runs the specified command.
//
-jitsu.start = function (callback) {
+jitsu.start = function (callback) {
//
// Check for --no-colors/--colors option, without hitting the config file
// yet
@@ -144,8 +144,8 @@ jitsu.start = function (callback) {
jitsu.init(function (err) {
if (err) {
jitsu.welcome();
- callback(err);
- return jitsu.showError(jitsu.argv._.join(' '), err);
+ jitsu.showError(jitsu.argv._.join(' '), err);
+ return callback(err);
}
jitsu.common.checkVersion(function (err) {
@@ -178,8 +178,8 @@ jitsu.start = function (callback) {
if (!username && jitsu.config.get('requiresAuth').indexOf(jitsu.argv._[0]) !== -1) {
return jitsu.commands.users.login(function (err) {
if (err) {
- callback(err);
- return jitsu.showError(jitsu.argv._.join(' '), err);
+ jitsu.showError(jitsu.argv._.join(' '), err);
+ return callback(err);
}
var username = jitsu.config.get('username');
@@ -233,8 +233,8 @@ jitsu.exec = function (command, callback) {
jitsu.log.info('Executing command ' + command.join(' ').magenta);
jitsu.router.dispatch('on', command.join(' '), jitsu.log, function (err, shallow) {
if (err) {
- callback(err);
- return jitsu.showError(command.join(' '), err, shallow);
+ jitsu.showError(command.join(' '), err, shallow);
+ return callback(err);
}
//
@@ -253,7 +253,7 @@ jitsu.exec = function (command, callback) {
// Sets up the instances of the Resource clients for jitsu.
// there is no io here, yet this function is ASYNC.
//
-jitsu.setup = function (callback) {
+jitsu.setup = function (callback) {
if (jitsu.started === true) {
return callback();
}
@@ -304,7 +304,7 @@ jitsu.showError = function (command, err, shallow, skip) {
}
else if (!skip) {
jitsu.log.error('Error running command ' + command.magenta);
-
+
if (!jitsu.config.get('nolog')) {
jitsu.logFile.log(err);
}
@@ -328,7 +328,7 @@ jitsu.showError = function (command, err, shallow, skip) {
jitsu.log.error('');
jitsu.log.error('This type of error is usually a ' + err.result.result.error.blame.type + ' error.');
}
-
+
jitsu.log.error('Error output from app:');
jitsu.log.error('');
if (err.result.result.error.stdout) {
@@ -336,7 +336,7 @@ jitsu.showError = function (command, err, shallow, skip) {
jitsu.log.error(line);
});
}
-
+
if (err.result.result.error.stderr) {
err.result.result.error.stderr.split('\n').forEach(function (line) {
jitsu.log.error(line);
@@ -347,13 +347,13 @@ jitsu.showError = function (command, err, shallow, skip) {
jitsu.log.error('There was an error while attempting to deploy the app');
jitsu.log.error('');
jitsu.log.error(err.result.result.error.message);
-
+
if (err.result.result.error.blame) {
jitsu.log.error(err.result.result.error.blame.message);
jitsu.log.error('');
jitsu.log.error('This type of error is usually a ' + err.result.result.error.blame.type + ' error.');
- }
-
+ }
+
jitsu.log.error('Error output from Haibu:');
jitsu.log.error('');
stack = err.result.result.error.result || err.result.result.error.stack;
Please sign in to comment.
Something went wrong with that request. Please try again.