diff --git a/.gitignore b/.gitignore index 4af7f37..7df6365 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store release node_modules +_site diff --git a/app/src/installer.js b/app/src/installer.js index a4bd5b3..960a9d9 100644 --- a/app/src/installer.js +++ b/app/src/installer.js @@ -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() { @@ -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){ diff --git a/app/src/main.js b/app/src/main.js index 967ad46..c1f30c9 100644 --- a/app/src/main.js +++ b/app/src/main.js @@ -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() { diff --git a/app/src/messages.js b/app/src/messages.js index 9728462..eba2d71 100644 --- a/app/src/messages.js +++ b/app/src/messages.js @@ -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 = {