Add error handing for managing extensions
This commit is contained in:
parent
024581de84
commit
9a3d239e6d
|
@ -592,37 +592,43 @@ function getModuleInformation() {
|
||||||
* Generates the HTML strings for all extensions and displays them in a popup.
|
* Generates the HTML strings for all extensions and displays them in a popup.
|
||||||
*/
|
*/
|
||||||
async function showExtensionsDetails() {
|
async function showExtensionsDetails() {
|
||||||
showLoader();
|
try{
|
||||||
let htmlDefault = '<h3>Built-in Extensions:</h3>';
|
showLoader();
|
||||||
let htmlExternal = '<h3>Installed Extensions:</h3>';
|
let htmlDefault = '<h3>Built-in Extensions:</h3>';
|
||||||
|
let htmlExternal = '<h3>Installed Extensions:</h3>';
|
||||||
|
|
||||||
const extensions = Object.entries(manifests).sort((a, b) => a[1].loading_order - b[1].loading_order);
|
const extensions = Object.entries(manifests).sort((a, b) => a[1].loading_order - b[1].loading_order);
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
||||||
for (const extension of extensions) {
|
for (const extension of extensions) {
|
||||||
promises.push(getExtensionData(extension));
|
promises.push(getExtensionData(extension));
|
||||||
}
|
|
||||||
|
|
||||||
const settledPromises = await Promise.allSettled(promises);
|
|
||||||
|
|
||||||
settledPromises.forEach(promise => {
|
|
||||||
if (promise.status === 'fulfilled') {
|
|
||||||
const { isExternal, extensionHtml } = promise.value;
|
|
||||||
if (isExternal) {
|
|
||||||
htmlExternal += extensionHtml;
|
|
||||||
} else {
|
|
||||||
htmlDefault += extensionHtml;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
const html = `
|
const settledPromises = await Promise.allSettled(promises);
|
||||||
${getModuleInformation()}
|
|
||||||
${htmlDefault}
|
settledPromises.forEach(promise => {
|
||||||
${htmlExternal}
|
if (promise.status === 'fulfilled') {
|
||||||
`;
|
const { isExternal, extensionHtml } = promise.value;
|
||||||
hideLoader();
|
if (isExternal) {
|
||||||
callPopup(`<div class="extensions_info">${html}</div>`, 'text');
|
htmlExternal += extensionHtml;
|
||||||
|
} else {
|
||||||
|
htmlDefault += extensionHtml;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const html = `
|
||||||
|
${getModuleInformation()}
|
||||||
|
${htmlDefault}
|
||||||
|
${htmlExternal}
|
||||||
|
`;
|
||||||
|
callPopup(`<div class="extensions_info">${html}</div>`, 'text');
|
||||||
|
} catch (error) {
|
||||||
|
toastr.error('Error loading extensions. See browser console for details.');
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue