Continue with other items if this throws

This commit is contained in:
RMidhunSuresh 2022-07-11 12:40:24 +05:30
parent d688fa4737
commit 6718198d9c

View file

@ -76,11 +76,16 @@ export class ThemeLoader {
const themeName = manifest.name; const themeName = manifest.name;
let defaultDarkVariant: any = {}, defaultLightVariant: any = {}; let defaultDarkVariant: any = {}, defaultLightVariant: any = {};
for (let [themeId, cssLocation] of Object.entries(builtAssets)) { for (let [themeId, cssLocation] of Object.entries(builtAssets)) {
try {
/** /**
* This cssLocation is relative to the location of the manifest file. * This cssLocation is relative to the location of the manifest file.
* So we first need to resolve it relative to the root of this hydrogen instance. * So we first need to resolve it relative to the root of this hydrogen instance.
*/ */
cssLocation = new URL(cssLocation, new URL(manifestLocation, window.location.origin)).href; cssLocation = new URL(cssLocation, new URL(manifestLocation, window.location.origin)).href;
}
catch {
continue;
}
const variant = themeId.match(/.+-(.+)/)?.[1]; const variant = themeId.match(/.+-(.+)/)?.[1];
const { name: variantName, default: isDefault, dark } = manifest.values.variants[variant!]; const { name: variantName, default: isDefault, dark } = manifest.values.variants[variant!];
const themeDisplayName = `${themeName} ${variantName}`; const themeDisplayName = `${themeName} ${variantName}`;