Skip to content

Commit

Permalink
Suggestion from feedback
Browse files Browse the repository at this point in the history
Co-authored-by: Simeon Vincent <[email protected]>
  • Loading branch information
rebloor and dotproto authored Nov 1, 2024
1 parent 7a61ba3 commit b2e1f8d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions favourite-colour/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ async function saveOptions(e) {
}

async function restoreOptions() {
try {
let res = await browser.storage.managed.get('colour');
document.querySelector("#managed-colour").innerText = res.colour;
} catch(error) {
console.log(JSON.stringify(error));
}
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';
Expand Down

0 comments on commit b2e1f8d

Please sign in to comment.