Skip to content

Commit

Permalink
Remove usage of DOMException.code (#34325)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Jun 21, 2024
1 parent dad86d7 commit 1dc4b45
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
3 changes: 1 addition & 2 deletions files/en-us/web/api/credentialscontainer/get/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ async function signIn() {
} catch (e) {
// Handle the error in some way, for example provide information
// to help the user succeed in a future sign-in attempt
const code = e.code;
const url = e.url;
console.error(e);
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ checkoutButton.addEventListener("click", () => {
});
})
.catch((error) => {
if (error.code === DOMException.NOT_SUPPORTED_ERR) {
if (error.name === "NotSupportedError") {
window.location.href = "https://bobpay.xyz/#download";
} else {
// Other kinds of errors; cancelled or failed payment. For demo purposes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,7 @@ function storageAvailable(type) {
} catch (e) {
return (
e instanceof DOMException &&
// everything except Firefox
(e.code === 22 ||
// Firefox
e.code === 1014 ||
// test name field too, because code might not be present
// everything except Firefox
e.name === "QuotaExceededError" ||
// Firefox
e.name === "NS_ERROR_DOM_QUOTA_REACHED") &&
e.name === "QuotaExceededError" &&
// acknowledge QuotaExceededError only if there's something already stored
storage &&
storage.length !== 0
Expand Down

0 comments on commit 1dc4b45

Please sign in to comment.