Handle iframe outright failing to load in new item page preview
This is a nice extra error handler to have, but note that it *won't* catch the case where the iframe successfully loads but the page returns a bad status code. In this case, we'll just show the loading state forever.
This commit is contained in:
parent
fcad7e2bc9
commit
7688caebe1
1 changed files with 1 additions and 0 deletions
|
@ -34,6 +34,7 @@ class OutfitLayer extends HTMLElement {
|
|||
} else if (iframe) {
|
||||
this.iframe = iframe;
|
||||
window.addEventListener("message", (m) => this.#onMessage(m));
|
||||
this.iframe.addEventListener("error", () => this.#setStatus("error"));
|
||||
this.#setStatus("loading");
|
||||
} else {
|
||||
throw new Error(`<outfit-layer> must contain an <img> or <iframe> tag`);
|
||||
|
|
Loading…
Reference in a new issue