You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by dp...@apache.org on 2018/08/26 18:11:43 UTC

[cordova-lib] 01/04: Q.prototype.fail -> Promise.prototype.catch

This is an automated email from the ASF dual-hosted git repository.

dpogue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git

commit 467ca1b2b3c9b1139b6e99afa82542fc7996ce52
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Sun Jun 17 05:36:46 2018 +0200

    Q.prototype.fail -> Promise.prototype.catch
---
 integration-tests/plugman_uninstall.spec.js | 2 +-
 spec/plugman/install.spec.js                | 2 +-
 src/cordova/platform/addHelper.js           | 2 +-
 src/plugman/fetch.js                        | 2 +-
 src/plugman/install.js                      | 4 ++--
 src/util/promise-util.js                    | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/integration-tests/plugman_uninstall.spec.js b/integration-tests/plugman_uninstall.spec.js
index 6c9e795..56846f5 100644
--- a/integration-tests/plugman_uninstall.spec.js
+++ b/integration-tests/plugman_uninstall.spec.js
@@ -303,7 +303,7 @@ describe('end', function () {
             .then(function () {
                 // Fails... A depends on
                 return uninstall('android', project, plugins['C']);
-            }).fail(function (err) {
+            }).catch(function (err) {
                 expect(err.stack).toMatch(/The plugin 'C' is required by \(A\), skipping uninstallation./);
             }).then(function () {
                 // dependencies on C,D ... should this only work with --recursive? prompt user..?
diff --git a/spec/plugman/install.spec.js b/spec/plugman/install.spec.js
index 79d81a3..d458a14 100644
--- a/spec/plugman/install.spec.js
+++ b/spec/plugman/install.spec.js
@@ -372,7 +372,7 @@ describe('install', function () {
                 return install('android', project, plugins['G'])
                     .then(function () {
                         common.spy.getInstall(emit);
-                    }).fail(function err (errMsg) {
+                    }).catch(function err (errMsg) {
                         expect(errMsg.toString()).toContain('Cyclic dependency from G to H');
                     });
             }, TIMEOUT);
diff --git a/src/cordova/platform/addHelper.js b/src/cordova/platform/addHelper.js
index aaf457a..c532f12 100644
--- a/src/cordova/platform/addHelper.js
+++ b/src/cordova/platform/addHelper.js
@@ -297,7 +297,7 @@ function downloadPlatform (projectRoot, platform, version, opts) {
         }
         events.emit('log', 'Using cordova-fetch for ' + target);
         return fetch(target, projectRoot, opts);
-    }).fail(function (error) {
+    }).catch(function (error) {
         var message = 'Failed to fetch platform ' + target +
             '\nProbably this is either a connection problem, or platform spec is incorrect.' +
             '\nCheck your connection and platform name/version/URL.' +
diff --git a/src/plugman/fetch.js b/src/plugman/fetch.js
index 7fe6920..705f4df 100644
--- a/src/plugman/fetch.js
+++ b/src/plugman/fetch.js
@@ -149,7 +149,7 @@ function fetchPlugin (plugin_src, plugins_dir, options) {
                 skipCopyingPlugin = false;
             }
             return P
-                .fail(function (error) {
+                .catch(function (error) {
                     var message = 'Failed to fetch plugin ' + plugin_src + ' via registry.' +
                         '\nProbably this is either a connection problem, or plugin spec is incorrect.' +
                         '\nCheck your connection and plugin name/version/URL.' +
diff --git a/src/plugman/install.js b/src/plugman/install.js
index aec2be3..8e67bea 100644
--- a/src/plugman/install.js
+++ b/src/plugman/install.js
@@ -364,7 +364,7 @@ function runInstall (actions, platform, project_dir, plugin_dir, plugins_dir, op
                 return handleInstall(actions, pluginInfo, platform, project_dir, plugins_dir, install_plugin_dir, filtered_variables, options);
             }
         }
-    ).fail(
+    ).catch(
         function (error) {
 
             if (error === 'skip') {
@@ -460,7 +460,7 @@ function tryFetchDependency (dep, install, options) {
                 var url = path.join(git_repo, dep.subdir);
                 dep.subdir = '';
                 return Q(url);
-            }).fail(function (error) { // eslint-disable-line handle-callback-err
+            }).catch(function () {
                 return Q(dep.url);
             });
 
diff --git a/src/util/promise-util.js b/src/util/promise-util.js
index df1081d..0f50411 100644
--- a/src/util/promise-util.js
+++ b/src/util/promise-util.js
@@ -40,7 +40,7 @@ function Q_chainmap_graceful (args, func, failureCallback) {
         return args.reduce(function (soFar, arg) {
             return soFar.then(function (val) {
                 return func(arg, val);
-            }).fail(function (err) {
+            }).catch(function (err) {
                 if (failureCallback) {
                     failureCallback(err);
                 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org