diff --git a/src/css-helpers.ts b/src/css-helpers.ts index 43c5e52..1611d19 100644 --- a/src/css-helpers.ts +++ b/src/css-helpers.ts @@ -5,7 +5,7 @@ const hostRe = /:host(\((.+)\))?/g; export function getEncapsulatedCss( template: HTMLTemplateElement, style: HTMLStyleElement, - selector: string, + selector: string ): string { const unique = `data-${selector}-css`; if (!style.sheet) { @@ -18,7 +18,7 @@ export function getEncapsulatedCss( continue; } for (const element of template.content.querySelectorAll( - rule.selectorText, + rule.selectorText )) { element.setAttribute(unique, ""); } diff --git a/src/index.ts b/src/index.ts index 5b34cb7..7f6cf1e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,7 +21,9 @@ async function fetchFromLinks(): Promise { async function defineHtml(link: HTMLLinkElement): Promise { const href = returnIfDefined(link.getAttribute("href")); - const response = await fetch(href); + const response = await fetch(href).catch((err) => { + throw new Error(`Unable to load ${href}`, { cause: err }); + }); const text = await response.text(); const definedElement = parser.parseFromString(text, "text/html"); customElements.define(...createComponent(definedElement, href));