You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ka...@apache.org on 2014/05/14 17:35:02 UTC
git commit: CB-6691: Change some instances of Error() to
CordovaError()
Repository: cordova-lib
Updated Branches:
refs/heads/master dccdfb376 -> 6f4022bd8
CB-6691: Change some instances of Error() to CordovaError()
Full stack is printed out when Error is thrown, but only the message for
CordovaError. Left it as Error in several paces I wasn't sure about.
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/6f4022bd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/6f4022bd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/6f4022bd
Branch: refs/heads/master
Commit: 6f4022bd88b5fc2deca96121a0278c0c72f89e3f
Parents: dccdfb3
Author: Mark Koudritsky <ka...@gmail.com>
Authored: Wed May 14 11:28:46 2014 -0400
Committer: Mark Koudritsky <ka...@gmail.com>
Committed: Wed May 14 11:28:46 2014 -0400
----------------------------------------------------------------------
cordova-lib/src/plugman/create.js | 5 +++--
cordova-lib/src/plugman/fetch.js | 3 ++-
cordova-lib/src/plugman/install.js | 10 +++++++---
cordova-lib/src/plugman/uninstall.js | 9 +++++----
4 files changed, 17 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/6f4022bd/cordova-lib/src/plugman/create.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/create.js b/cordova-lib/src/plugman/create.js
index b8493b2..919f5e2 100644
--- a/cordova-lib/src/plugman/create.js
+++ b/cordova-lib/src/plugman/create.js
@@ -20,7 +20,8 @@ var Q = require('q'),
fs = require('fs'),
path = require('path'),
shell = require('shelljs'),
- et = require('elementtree');
+ et = require('elementtree'),
+ CordovaError = require('../CordovaError');
module.exports = function create( name, id, version, pluginPath, options ) {
var cwd = pluginPath + "/" + name + "/",
@@ -34,7 +35,7 @@ module.exports = function create( name, id, version, pluginPath, options ) {
//check we are not already in a plugin
if( fs.existsSync( cwd + 'plugin.xml' ) ) {
- return Q.reject( new Error( 'plugin.xml already exists. Are you already in a plugin?' ) );
+ return Q.reject( new CordovaError( 'plugin.xml already exists. Are you already in a plugin?' ) );
}
//Create a plugin.xml file
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/6f4022bd/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index 318e90e..b8a43c1 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -3,6 +3,7 @@ var shell = require('shelljs'),
url = require('url'),
plugins = require('./util/plugins'),
xml_helpers = require('../util/xml-helpers'),
+ CordovaError = require('../CordovaError'),
events = require('./events'),
metadata = require('./util/metadata'),
path = require('path'),
@@ -45,7 +46,7 @@ module.exports = function fetchPlugin(plugin_src, plugins_dir, options) {
if ( uri.protocol && uri.protocol != 'file:' && uri.protocol != 'c:' && !plugin_src.match(/^\w+:\\/)) {
events.emit('log', 'Fetching plugin "' + plugin_src + '" via git clone');
if (options.link) {
- return Q.reject(new Error('--link is not supported for git URLs'));
+ return Q.reject(new CordovaError('--link is not supported for git URLs'));
} else {
var data = {
source: {
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/6f4022bd/cordova-lib/src/plugman/install.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/install.js b/cordova-lib/src/plugman/install.js
index e91c65c..da630e3 100644
--- a/cordova-lib/src/plugman/install.js
+++ b/cordova-lib/src/plugman/install.js
@@ -7,6 +7,7 @@ var path = require('path'),
semver = require('semver'),
config_changes = require('./util/config-changes'),
xml_helpers = require('../util/xml-helpers'),
+ CordovaError = require('../CordovaError'),
Q = require('q'),
platform_modules = require('./platforms'),
os = require('os'),
@@ -45,7 +46,7 @@ module.exports = function installPlugin(platform, project_dir, id, plugins_dir,
plugins_dir = plugins_dir || path.join(project_dir, 'cordova', 'plugins');
if (!platform_modules[platform]) {
- return Q.reject(new Error(platform + " not supported."));
+ return Q.reject(new CordovaError(platform + " not supported."));
}
var current_stack = new action_stack();
@@ -87,7 +88,10 @@ function checkEngines(engines) {
if(semver.satisfies(engine.currentVersion, engine.minVersion) || engine.currentVersion === null){
// engine ok!
}else{
- return Q.reject(new Error('Plugin doesn\'t support this project\'s '+engine.name+' version. '+engine.name+': ' + engine.currentVersion + ', failed version requirement: ' + engine.minVersion));
+ var msg = "Plugin doesn't support this project's " + engine.name + ' version. ' +
+ engine.name + ': ' + engine.currentVersion +
+ ', failed version requirement: ' + engine.minVersion;
+ return Q.reject(new CordovaError(msg));
}
}
@@ -340,7 +344,7 @@ function installDependencies(install, dependencies, options) {
}
if (!dep.id) {
- throw new Error('<dependency> tag is missing id attribute: ' + elementtree.tostring(depXml, {xml_declaration:false}));
+ throw new CordovaError('<dependency> tag is missing id attribute: ' + elementtree.tostring(depXml, {xml_declaration:false}));
}
// We build the dependency graph only to be able to detect cycles, getChain will throw an error if it detects one
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/6f4022bd/cordova-lib/src/plugman/uninstall.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/uninstall.js b/cordova-lib/src/plugman/uninstall.js
index fcb4d6b..07b62a7 100644
--- a/cordova-lib/src/plugman/uninstall.js
+++ b/cordova-lib/src/plugman/uninstall.js
@@ -7,6 +7,7 @@ var path = require('path'),
xml_helpers = require('../util/xml-helpers'),
action_stack = require('./util/action-stack'),
dependencies = require('./util/dependencies'),
+ CordovaError = require('../CordovaError'),
underscore = require('underscore'),
Q = require('q'),
plugins = require('./util/plugins'),
@@ -42,12 +43,12 @@ module.exports.uninstallPlatform = function(platform, project_dir, id, plugins_d
plugins_dir = plugins_dir || path.join(project_dir, 'cordova', 'plugins');
if (!platform_modules[platform]) {
- return Q.reject(new Error(platform + " not supported."));
+ return Q.reject(new CordovaError(platform + " not supported."));
}
var plugin_dir = path.join(plugins_dir, id);
if (!fs.existsSync(plugin_dir)) {
- return Q.reject(new Error('Plugin "' + id + '" not found. Already uninstalled?'));
+ return Q.reject(new CordovaError('Plugin "' + id + '" not found. Already uninstalled?'));
}
var current_stack = new action_stack();
@@ -146,7 +147,7 @@ module.exports.uninstallPlugin = function(id, plugins_dir, options) {
msg += ' and cannot be removed (hint: use -f or --force)';
if(plugin_id == top_plugin_id) {
- return Q.reject( new Error(msg) );
+ return Q.reject( new CordovaError(msg) );
} else {
events.emit('warn', msg +' and cannot be removed (hint: use -f or --force)');
continue;
@@ -180,7 +181,7 @@ function runUninstallPlatform(actions, platform, project_dir, plugin_dir, plugin
if(options.force) {
events.emit("info", msg + " but forcing removal");
} else {
- return Q.reject( new Error(msg + ", skipping uninstallation.") );
+ return Q.reject( new CordovaError(msg + ", skipping uninstallation.") );
}
}