Skip to content

Commit

Permalink
Merge pull request #12 from CreativeDo/more-error-codes
Browse files Browse the repository at this point in the history
More error codes
  • Loading branch information
Cameron423698 committed Nov 14, 2015
2 parents 8c880f4 + 543817e commit 860d3b7
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
release
node_modules
_site
4 changes: 3 additions & 1 deletion app/src/installer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var platform = require("os").platform;
var install_process = require("child_process");
var path = require('path');
var errors = (new global.Messages()).errors

global.installer = function() {

Expand Down Expand Up @@ -34,7 +35,8 @@ global.installer = function() {
spawn.stdout.on('data',function(data){
console.log('stdout: ' + data.toString());
var logbits = /-(\d+)/.exec(data.toString());
reject(logbits && logbits[1] ? parseInt(logbits[1]) : null);
var code = logbits && logbits[1] ? parseInt(logbits[1]) : null;
reject(errors.get(code) || 'Error: ' + data.toString());
});

spawn.stderr.on('data',function(data){
Expand Down
5 changes: 2 additions & 3 deletions app/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ global.View = function() {
toggleSpinner(true);
}

var installationFailed = function(error) {

var installationFailed = function(err) {
toggleSpinner(false);
updateStatus(msg.errors[error] || 'Error: ' + error);
updateStatus(err);
}

var installationSuccess = function() {
Expand Down
70 changes: 59 additions & 11 deletions app/src/messages.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,65 @@
global.Messages = function() {

var errorMessages = [
{
codes: [0],
message: 'Installation failed because it could not be downloaded. It should not be possible to receive this error.'
},{
codes: [152,154,155,156,157,158,160,161,162,163,164,165,168,169,171,172,176,178,179],
message: 'Installation failed because of a file operation error.'
},{
codes: [251,252,253,254,255,256,257,259,260,261,265,266,267,268,269,270,271,272],
message: 'Installation failed because ZXPInstaller could not parse the .zxp file.'
},{
codes: [500,501,502,503,504,505,506,507,508,508,509],
message: 'Installation failed because ZXPInstaller could not update the database. It should not be possible to receive this error.'
},{
codes: [601,602,603,604,651,652,653],
message: 'Installation failed because it the ZXPInstaller could not check the license online.'
},{
codes: [159],
message: 'ZXPInstaller cannot install this type of file. Please use a .zxp file.'
},{
codes: [175],
message: 'You must run ZXPInstaller in administrator mode to install extensions.'
},{
codes: [201],
message: 'Installation failed because the extension invalid.'
},{
codes: [402],
message: 'Installation failed because the extension does not contain a valid code signature.'
},{
codes: [403,411],
message: 'Installation failed because the extension is not compatible with the installed applications.'
},{
codes: [407,408],
message: 'Installation failed because this extension requires another extension.'
},{
codes: [412],
message: 'Installation failed because an extension of the same name exists.'
},{
codes: [418],
message: 'Installation failed because a newer version of the extension is installed.'
},{
codes: [456],
message: 'Please close all Adobe applications before installing extensions.'
},{
codes: [458],
message: 'Installation failed because none of the required applications are installed'
},{
codes: [459],
message: 'Installation failed because the extension is not compatible with the installed applications.'
}
];

this.errors = {
159: 'ZXPInstaller cannot install this type of file. Please use a .zxp file.',
175: 'You must run ZXPInstaller in administrator mode to install extensions.',
201: 'Installation failed because the extension invalid.',
411: 'Installation failed because the extension is not compatible with the installed applications.',
407: 'Installation failed because this extension requires another extension.',
408: 'Installation failed because this extension requires another extension.',
412: 'Installation failed because an extension of the same name exists.',
418: 'Installation failed because a newer version of the extension is installed.',
456: 'Please close all Adobe applications before installing extensions.',
458: 'Installation failed because none of the required applications are installed',
459: 'Installation failed because the extension is not compatible with the installed applications.'
get: function(code) {
var msg = '';
$.each(errorMessages, function(key, error){
if ($.inArray(code, error.codes) > -1) msg = error.message;
});
return (msg !== '') ? msg : null;
}
};

this.ui = {
Expand Down

0 comments on commit 860d3b7

Please sign in to comment.