message: Code cleaning - Creating the error in installContribution method
diff: @@ -29,28 +29,24 @@ export class ContribInstallController {
  }
  /**
  - * Install the contribution accessible in a URL (preferrably github URL) to the engine and restart the engine
  + * Install the contribution accessible in a URL (github URL) to engine and restart the engine
  * @param url {string} URL path where the acitivy / trigger .json is located
  * @returns results {Object} results of installation
  * @returns results.success {array} array of successfully installed contribution urls
  * @returns results.fail {array} array of installation failed contribution urls
  */
  install(url) {
  - return this.installContributions(url)
  + let results = {};
  + return this.installContribution(url)
  .then(installResults => {
  - if (installResults.fail.length === 0) {
  - return this.buildEngine()
  - .then(() => {
  + results = installResults;
  + return this.buildEngine();
  + }).then(() => {
  logger.debug(`Restarting the engine upon successful '${url}' installation.`);
  return this.restartEngineAfterBuild();
  - })
  - .then(() => this.updateContribsDB())
  + }).then(() => this.updateContribsDB())
  .then(() => this.removeBackup())
  - .then(() => installResults);
  - } else {
  - throw new Error('Cannot install a contribution outside github domain');
  - }
  - })
  + .then(() => results)
  .catch(err => {
  logger.error(`[error] Encountered error while installing the '${url}' to the engine: `);
  logger.error(err);
  @@ -64,7 +60,7 @@ export class ContribInstallController {
  });
  }
  - installContributions(url) {
  + installContribution(url) {
  return this.createBackup()
  .then(() => this.installToEngine(url))
  .then((results) => {
  @@ -73,6 +69,9 @@ export class ContribInstallController {
  success: results.success,
  fail: results.fail
  });
  + if (results.fail.length) {
  + throw new Error('Cannot install a contribution outside github domain');
  + }
  return omit(results, ['details']);
  });
  }
  