Bug 1456051 - Propagate OS errors on addon installation. r=maja_zf
authorAndreas Tolfsen <ato@sny.no>
Mon, 23 Apr 2018 07:48:54 +0100
changeset 468587 52c5217fc17b08444fb3d5e426361e885aae1631
parent 468586 59953ad26fcf3464756f52562ee46adbda532549
child 468588 db7a5dec3809ae5d66946b1316ff7ac6a3761eea
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaja_zf
bugs1456051
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1456051 - Propagate OS errors on addon installation. r=maja_zf The error descriptions are rather vague and may obfuscate the real problem. This changes the messages to be more in line with the underlying error, and also ensures the original error is propagated. MozReview-Commit-ID: EjctkgeUgNH
testing/marionette/addon.js
testing/marionette/harness/marionette_harness/tests/unit/test_addons.py
--- a/testing/marionette/addon.js
+++ b/testing/marionette/addon.js
@@ -82,32 +82,32 @@ async function installAddon(file) {
  */
 addon.install = async function(path, temporary = false) {
   let addon;
   let file;
 
   try {
     file = new FileUtils.File(path);
   } catch (e) {
-    throw new UnknownError(`${path} is not an absolute path.`);
+    throw new UnknownError(`Expected absolute path: ${e}`, e);
   }
 
   if (!file.exists()) {
-    throw new UnknownError(`Could not find add-on at '${path}'`);
+    throw new UnknownError(`No such file or directory: ${path}`);
   }
 
   try {
     if (temporary) {
       addon = await AddonManager.installTemporaryAddon(file);
     } else {
       addon = await installAddon(file);
     }
   } catch (e) {
     throw new UnknownError(
-        `Could not install add-on at '${path}': ${e.message}`);
+        `Could not install add-on: ${path}: ${e.message}`, e);
   }
 
   return addon.id;
 };
 
 /**
  * Uninstall a Firefox addon.
  *
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_addons.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_addons.py
@@ -91,14 +91,14 @@ class TestAddons(MarionetteTestCase):
         addon_path = os.path.join(here, "webextension-unsigned.xpi")
 
         with self.assertRaises(AddonInstallException):
             self.addons.install(addon_path)
 
     def test_install_nonexistent_addon(self):
         addon_path = os.path.join(here, "does-not-exist.xpi")
 
-        with self.assertRaisesRegexp(AddonInstallException, "Could not find add-on at"):
+        with self.assertRaises(AddonInstallException):
             self.addons.install(addon_path)
 
     def test_install_with_relative_path(self):
-        with self.assertRaisesRegexp(AddonInstallException, "is not an absolute path."):
+        with self.assertRaises(AddonInstallException):
             self.addons.install('webextension.xpi')