cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject cordova-lib git commit: CB-9124 Makes network-related errors' messages more descriptive.
Date Tue, 09 Jun 2015 09:08:08 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 00c5262b1 -> c3485e214


CB-9124 Makes network-related errors' messages more descriptive.


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/c3485e21
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/c3485e21
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/c3485e21

Branch: refs/heads/master
Commit: c3485e21412bbc73711cc6bd32a93a7ee2a1fe1f
Parents: 00c5262
Author: Vladimir Kotikov <v-vlkoti@microsoft.com>
Authored: Fri Jun 5 17:14:28 2015 +0300
Committer: Vladimir Kotikov <v-vlkoti@microsoft.com>
Committed: Tue Jun 9 12:08:23 2015 +0300

----------------------------------------------------------------------
 cordova-lib/src/cordova/create.js            | 13 ++++++++++---
 cordova-lib/src/cordova/platform.js          | 12 ++++++++----
 cordova-lib/src/plugman/fetch.js             | 16 ++++++++++++++--
 cordova-lib/src/plugman/registry/registry.js |  3 ---
 4 files changed, 32 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c3485e21/cordova-lib/src/cordova/create.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/create.js b/cordova-lib/src/cordova/create.js
index 6c36d56..43ee937 100644
--- a/cordova-lib/src/cordova/create.js
+++ b/cordova-lib/src/cordova/create.js
@@ -57,7 +57,7 @@ function create(dir, optionalId, optionalName, cfg) {
 
         //read projects .cordova/config.json file for project settings
         var configFile = config.read(dir);
-        
+
         //if data exists in the configFile, lets combine it with cfg
         //cfg values take priority over config file
         if(configFile) {
@@ -72,7 +72,7 @@ function create(dir, optionalId, optionalName, cfg) {
 
             cfg = finalConfig;
         }
-        
+
         if (!cfg) {
             throw new CordovaError('Must provide a project configuration.');
         } else if (typeof cfg == 'string') {
@@ -162,7 +162,14 @@ function create(dir, optionalId, optionalName, cfg) {
             return cfg.lib.www.url;
         } else {
             events.emit('verbose', 'Copying assets."');
-            return lazy_load.custom({ 'www': cfg.lib.www }, 'www');
+            return lazy_load.custom({ 'www': cfg.lib.www }, 'www')
+            .fail(function (error) {
+                var message = 'Failed to fetch custom www assets from ' + cfg.lib.www +
+                    '\nProbably this is either a connection problem, or assets URL is incorrect.'
+
+                    '\nCheck your connection and assets URL.' +
+                    '\n' + error;
+                return Q.reject(message);
+            });
         }
     })
     .then(function(import_from_path) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c3485e21/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index 11d1930..2e6f204 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -243,10 +243,14 @@ function downloadPlatform(projectRoot, platform, version, opts) {
             });
         }
         return lazy_load.based_on_config(projectRoot, target, opts);
+    }).fail(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.' +
+            '\n' + error;
+        return Q.reject(new CordovaError(message));
     }).then(function(libDir) {
         return getPlatformDetailsFromDir(libDir, platform);
-    }, function(err) {
-        throw new CordovaError('Unable to fetch platform ' + target + ': ' + err);
     });
 }
 
@@ -656,7 +660,7 @@ function copy_cordova_js(projectRoot, platform) {
     shell.cp('-f', path.join(parser.www_dir(), 'cordova.js'), path.join(platform_www, 'cordova.js'));
 }
 
-// Copy cordova-js-src directory into platform_www directory. 
+// Copy cordova-js-src directory into platform_www directory.
 // We need these files to build cordova.js if using browserify method.
 function copy_cordovajs_src(projectRoot, platform, platLib) {
     var platformPath = path.join(projectRoot, 'platforms', platform);
@@ -666,7 +670,7 @@ function copy_cordovajs_src(projectRoot, platform, platLib) {
     //only exists for platforms that have shipped cordova-js-src directory
     if(fs.existsSync(cordovaJsSrcPath)) {
         shell.cp('-rf', cordovaJsSrcPath, platform_www);
-    } 
+    }
 }
 
 // Remove <platform>.json file from plugins directory.

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c3485e21/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index 1a2b657..ec4c03a 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -81,6 +81,11 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
             }
 
             return plugins.clonePluginGit(plugin_src, plugins_dir, options)
+            .fail(function (error) {
+                var message = 'Failed to fetch plugin ' + plugin_src + ' via git.' +
+                    '\nEither there is a connection problems, or plugin spec is incorrect:\n\t'
+ error;
+                return Q.reject(new CordovaError(message));
+            })
             .then(function(dir) {
                 return {
                     pinfo: pluginInfoProvider.get(dir),
@@ -127,6 +132,13 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
             }
             // If not found in local search path, fetch from the registry.
             return registry.fetch([plugin_src], options.client)
+            .fail(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.' +
+                    '\n' + error;
+                return Q.reject(new CordovaError(message));
+            })
             .then(function(dir) {
                 return {
                     pinfo: pluginInfoProvider.get(dir),
@@ -147,7 +159,7 @@ function fetchPlugin(plugin_src, plugins_dir, options) {
     }).then(function(result){
         checkID(options.expected_id, result.pinfo);
         var data = { source: result.fetchJsonSource };
-        data.is_top_level = options.is_top_level; 
+        data.is_top_level = options.is_top_level;
         data.variables = options.variables || {};
         metadata.save_fetch_metadata(plugins_dir, result.pinfo.id, data);
         return result.dest;
@@ -240,7 +252,7 @@ function findLocalPlugin(plugin_src, searchpath, pluginInfoProvider) {
 
 
 // Copy or link a plugin from plugin_dir to plugins_dir/plugin_id.
-// if alternative ID of plugin exists in plugins_dir/plugin_id, skip copying 
+// if alternative ID of plugin exists in plugins_dir/plugin_id, skip copying
 function copyPlugin(pinfo, plugins_dir, link) {
 
     var plugin_dir = pinfo.dir;

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/c3485e21/cordova-lib/src/plugman/registry/registry.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/registry.js b/cordova-lib/src/plugman/registry/registry.js
index 71810a3..7ea0911 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -358,9 +358,6 @@ function fetchPlugin(plugin, client, useNpmRegistry) {
             var package_tgz = path.resolve(npm.cache, info.name, info.version, 'package.tgz');
             return unpack.unpackTgz(package_tgz, pluginDir);
         });
-    }).fail(function(error) {
-        events.emit('log', 'Fetching from ' + registryName + ' failed: ' + error.message);
-        return Q.reject(error);
     });
 }
 


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


Mime
View raw message