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
--- 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')