Skip to content

Commit 38ac6cf

Browse files
committed
Promise return values tweaked
1 parent 0b39c05 commit 38ac6cf

4 files changed

Lines changed: 24 additions & 24 deletions

File tree

lib/commands/install.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ module.exports = function (dependencies) {
565565
if (installErrored.length == 1) {
566566
var error = _.clone(Errors.ERROR_INSTALL_ERROR);
567567

568-
if (p._installError) error.msg = p._installError;
568+
if (p._installError) error.message = p._installError;
569569

570570
return Q.reject(error);
571571
}
@@ -592,7 +592,7 @@ module.exports = function (dependencies) {
592592
installErrored.forEach(function(p) {
593593
var error = _.clone(Errors.ERROR_INSTALL_ERROR);
594594

595-
if (p._installError) error.msg = p._installError;
595+
if (p._installError) error.message = p._installError;
596596

597597
report.push({
598598
name:p.packageName,

lib/commands/uninstall.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919
var project = new Project(Constants.DefaultProjectManifestPath, Constants.DefaultProjectFrameworkPath);
2020

2121
if(!project.isProjectContainsManifestFile()) {
22-
return Q.reject({error:Errors.ERROR_COURSE_DIR});
22+
return Q.reject(Errors.ERROR_COURSE_DIR);
2323
}
2424

2525
var plugin = Plugin.parse(pluginName);
@@ -58,14 +58,14 @@ module.exports = {
5858
if (removePath) {
5959
rimraf(removePath, function() {
6060
if (fs.existsSync(removePath)) {
61-
deferred.reject({error:Errors.ERROR_UNINSTALL});
61+
deferred.reject(Errors.ERROR_UNINSTALL);
6262
} else {
6363
project.remove(plugin);
6464
deferred.resolve(pluginName);
6565
}
6666
});
6767
} else {
68-
deferred.reject({error:Errors.ERROR_NOT_FOUND});
68+
deferred.reject(Errors.ERROR_NOT_FOUND);
6969
}
7070
});
7171

lib/commands/update.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module.exports = function() {
6363
installedPlugins = {};
6464

6565
if (!project.isProjectContainsManifestFile()) {
66-
return Q.reject({error:Errors.ERROR_COURSE_DIR});
66+
return Q.reject(Errors.ERROR_COURSE_DIR);
6767
}
6868

6969
args = pluginName ? [pluginName] : ['all'];
@@ -251,7 +251,7 @@ module.exports = function() {
251251
if (isInteractive) {
252252
return Q.reject({message:'No valid targets specified (please check spelling and case).'});
253253
}
254-
return Q.reject({error:Errors.ERROR_NOTHING_TO_UPDATE});
254+
return Q.reject(Errors.ERROR_NOTHING_TO_UPDATE);
255255
} else {
256256
return Q.resolve();
257257
}
@@ -473,7 +473,7 @@ module.exports = function() {
473473
return p.packageName;
474474
});
475475

476-
return Q.reject({error:Errors.ERROR_UPDATE_INCOMPATIBLE, context:names});
476+
return Q.reject(Errors.ERROR_UPDATE_INCOMPATIBLE);
477477
}
478478

479479
function promptToUpdateIncompatible() {
@@ -651,7 +651,7 @@ module.exports = function() {
651651
if (errored.length == 1) {
652652
var error = _.clone(Errors.ERROR_UPDATE_ERROR);
653653

654-
if (p._updateError) error.msg = p._updateError;
654+
if (p._updateError) error.message = p._updateError;
655655

656656
return Q.reject(error);
657657
}
@@ -686,7 +686,7 @@ module.exports = function() {
686686
errored.forEach(function(p) {
687687
var error = _.clone(Errors.ERROR_UPDATE_ERROR);
688688

689-
if (p._updateError) error.msg = p._updateError;
689+
if (p._updateError) error.message = p._updateError;
690690

691691
report.push({
692692
name: p.packageName,

lib/errors.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
module.exports = {
22
ERROR_COURSE_DIR: {
33
code: 0,
4-
msg: "Commands must be run in an Adapt project directory"
4+
message: "Commands must be run in an Adapt project directory"
55
},
66
ERROR_INCOMPATIBLE_VALID_REQUEST: {
77
code: 1,
8-
msg: "No compatible version exists (requested version is valid)"
8+
message: "No compatible version exists (requested version is valid)"
99
},
1010
ERROR_INCOMPATIBLE_BAD_REQUEST: {
1111
code: 2,
12-
msg: "No compatible version exists (requested version is invalid)"
12+
message: "No compatible version exists (requested version is invalid)"
1313
},
1414
ERROR_INCOMPATIBLE: {
1515
code: 3,
16-
msg: "No compatible version exists"
16+
message: "No compatible version exists"
1717
},
1818
ERROR_COMPATIBLE_INC_REQUEST: {
1919
code: 4,
20-
msg: "Incompatible version requested (compatible version exists)"
20+
message: "Incompatible version requested (compatible version exists)"
2121
},
2222
ERROR_COMPATIBLE_BAD_REQUEST: {
2323
code: 5,
24-
msg: "Requested version is invalid"
24+
message: "Requested version is invalid"
2525
},
2626
ERROR_UNINSTALL: {
2727
code: 6,
28-
msg: "The plugin could not be uninstalled"
28+
message: "The plugin could not be uninstalled"
2929
},
3030
ERROR_NOT_FOUND: {
3131
code: 7,
32-
msg: "The plugin could not be found"
32+
message: "The plugin could not be found"
3333
},
3434
ERROR_NOTHING_TO_UPDATE: {
3535
code: 8,
36-
msg: "Could not resolve any plugins to update"
36+
message: "Could not resolve any plugins to update"
3737
},
3838
ERROR_UPDATE_INCOMPATIBLE: {
3939
code: 9,
40-
msg: "Incompatible update requested"
40+
message: "Incompatible update requested"
4141
},
4242
ERROR_INSTALL_ERROR: {
4343
code: 10,
44-
msg: "Unknown installation error"
44+
message: "Unknown installation error"
4545
},
4646
ERROR_UPDATE_ERROR: {
4747
code: 11,
48-
msg: "Unknown update error"
48+
message: "Unknown update error"
4949
},
5050
ERROR_NO_RELEASES: {
5151
code: 12,
52-
msg: "No published releases"
52+
message: "No published releases"
5353
},
5454
ERROR_NO_UPDATE: {
5555
code: 13,
56-
msg: "No update available"
56+
message: "No update available"
5757
}
5858
}

0 commit comments

Comments
 (0)