From 77261ffd4363fa1d57020c6a3a4579e85702d1a8 Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Fri, 5 Sep 2014 14:00:51 +0900 Subject: [PATCH] Remove unused errors and make STF error codes match Android error codes better. --- lib/units/device/plugins/install.js | 6 +++--- .../components/stf/install/install-error-filter.js | 12 +++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/units/device/plugins/install.js b/lib/units/device/plugins/install.js index ad06cda8..65c4e832 100644 --- a/lib/units/device/plugins/install.js +++ b/lib/units/device/plugins/install.js @@ -161,14 +161,14 @@ module.exports = syrup.serial() .then(function() { push.send([ channel - , reply.okay('success') + , reply.okay('INSTALL_SUCCEEDED') ]) }) .catch(Promise.TimeoutError, function(err) { log.error('Installation of package "%s" failed', pkg, err.stack) push.send([ channel - , reply.fail('timeout') + , reply.fail('INSTALL_ERROR_TIMEOUT') ]) }) .catch(InstallationError, function(err) { @@ -186,7 +186,7 @@ module.exports = syrup.serial() log.error('Installation of package "%s" failed', pkg, err.stack) push.send([ channel - , reply.fail('fail') + , reply.fail('INSTALL_ERROR_UNKNOWN') ]) }) }) diff --git a/res/app/components/stf/install/install-error-filter.js b/res/app/components/stf/install/install-error-filter.js index b68d2829..a226c66c 100644 --- a/res/app/components/stf/install/install-error-filter.js +++ b/res/app/components/stf/install/install-error-filter.js @@ -6,15 +6,9 @@ var responses = require('./response-codes.json') module.exports = function installErrorFilter(gettext) { return function (text) { switch (text) { - case 'fail_invalid_app_file': - return gettext('Uploaded file is not valid.') - case 'fail_download': - return gettext('Failed to download specified URL.') - case 'fail_invalid_url': - return gettext('The specified URL is invalid.') - case 'fail': - return gettext('Upload failed to due unknown error.') - case 'timeout': + case 'INSTALL_ERROR_UNKNOWN': + return gettext('Installation failed due to an unknown error.') + case 'INSTALL_ERROR_TIMEOUT': return gettext('Installation timed out.') default: return gettext(responses[text] || text)