2
0
mirror of https://github.com/iconify/iconify.git synced 2025-01-07 15:44:05 +00:00

Do not use optional catch binding in core

This commit is contained in:
Vjacheslav Trushkin 2022-04-29 23:30:20 +03:00
parent b183dade9d
commit 4601d540ef
3 changed files with 11 additions and 11 deletions

View File

@ -27,7 +27,7 @@ const detectFetch = (): FetchType | null => {
if (typeof callback === 'function') { if (typeof callback === 'function') {
return callback; return callback;
} }
} catch { } catch (err) {
// //
} }

View File

@ -89,7 +89,7 @@ function getGlobal(key: keyof StorageConfig): typeof localStorage | null {
) { ) {
return _window[attr]; return _window[attr];
} }
} catch { } catch (err) {
// //
} }
@ -110,7 +110,7 @@ function setCount(
storage.setItem(countKey, value.toString()); storage.setItem(countKey, value.toString());
count[key] = value; count[key] = value;
return true; return true;
} catch { } catch (err) {
// //
} }
return false; return false;
@ -142,7 +142,7 @@ function initCache(
): void { ): void {
try { try {
storage.setItem(versionKey, cacheVersion); storage.setItem(versionKey, cacheVersion);
} catch { } catch (err) {
// //
} }
setCount(storage, key, 0); setCount(storage, key, 0);
@ -159,7 +159,7 @@ function destroyCache(storage: typeof localStorage): void {
for (let i = 0; i < total; i++) { for (let i = 0; i < total; i++) {
storage.removeItem(cachePrefix + i.toString()); storage.removeItem(cachePrefix + i.toString());
} }
} catch { } catch (err) {
// //
} }
} }
@ -214,7 +214,7 @@ export const loadCache: LoadIconsCache = (): void => {
const storage = getStorage(provider, prefix); const storage = getStorage(provider, prefix);
valid = addIconSet(storage, data.data).length > 0; valid = addIconSet(storage, data.data).length > 0;
} }
} catch { } catch (err) {
valid = false; valid = false;
} }
@ -254,7 +254,7 @@ export const loadCache: LoadIconsCache = (): void => {
// Update total // Update total
setCount(func, key, total); setCount(func, key, total);
} catch { } catch (err) {
// //
} }
} }
@ -303,7 +303,7 @@ export const storeCache: CacheIcons = (
data, data,
}; };
func.setItem(cachePrefix + index.toString(), JSON.stringify(item)); func.setItem(cachePrefix + index.toString(), JSON.stringify(item));
} catch { } catch (err) {
return false; return false;
} }
return true; return true;

View File

@ -47,7 +47,7 @@ try {
if (w && w._iconifyStorage.version === storageVersion) { if (w && w._iconifyStorage.version === storageVersion) {
storage = w._iconifyStorage.storage; storage = w._iconifyStorage.storage;
} }
} catch { } catch (err) {
// //
} }
@ -63,7 +63,7 @@ export function shareStorage(): void {
storage, storage,
}; };
} }
} catch { } catch (err) {
// //
} }
} }
@ -128,7 +128,7 @@ export function addIconToStorage(
storage.icons[name] = Object.freeze(fullIcon(icon)); storage.icons[name] = Object.freeze(fullIcon(icon));
return true; return true;
} }
} catch { } catch (err) {
// Do nothing // Do nothing
} }
return false; return false;