diff --git a/favourite-colour/options.js b/favourite-colour/options.js index 542fa1e9..73d45824 100644 --- a/favourite-colour/options.js +++ b/favourite-colour/options.js @@ -6,8 +6,16 @@ async function saveOptions(e) { } async function restoreOptions() { - let res = await browser.storage.managed.get('colour'); - document.querySelector("#managed-colour").innerText = res.colour; + try { + let res = await browser.storage.managed.get('colour'); + document.querySelector("#managed-colour").innerText = res.colour || "Could not find 'colour' in managed storage."; + } catch(error) { + if (error.message === "Managed storage manifest not found") { + document.querySelector("#managed-colour").innerText = "Managed storage manifest not found. Make sure it's stored in an appropriate location."; + } else { + document.querySelector("#managed-colour").innerText = `Unexpected managed storage error: ${error.message}`; + } + } res = await browser.storage.sync.get('colour'); document.querySelector("#colour").value = res.colour || 'Firefox red';