From 9a3d239e6d5b92a5edd6d08bf875ca6c684331f8 Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Fri, 10 Nov 2023 10:25:34 +0200
Subject: [PATCH] Add error handing for managing extensions
---
public/scripts/extensions.js | 60 ++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 27 deletions(-)
diff --git a/public/scripts/extensions.js b/public/scripts/extensions.js
index fe6303e3d..19509085b 100644
--- a/public/scripts/extensions.js
+++ b/public/scripts/extensions.js
@@ -592,37 +592,43 @@ function getModuleInformation() {
* Generates the HTML strings for all extensions and displays them in a popup.
*/
async function showExtensionsDetails() {
- showLoader();
- let htmlDefault = '
Built-in Extensions:
';
- let htmlExternal = 'Installed Extensions:
';
+ try{
+ showLoader();
+ let htmlDefault = 'Built-in Extensions:
';
+ let htmlExternal = 'Installed Extensions:
';
- const extensions = Object.entries(manifests).sort((a, b) => a[1].loading_order - b[1].loading_order);
- const promises = [];
+ const extensions = Object.entries(manifests).sort((a, b) => a[1].loading_order - b[1].loading_order);
+ const promises = [];
- for (const extension of extensions) {
- 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;
- }
+ for (const extension of extensions) {
+ promises.push(getExtensionData(extension));
}
- });
- const html = `
- ${getModuleInformation()}
- ${htmlDefault}
- ${htmlExternal}
- `;
- hideLoader();
- callPopup(`${html}
`, 'text');
+ 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 = `
+ ${getModuleInformation()}
+ ${htmlDefault}
+ ${htmlExternal}
+ `;
+ callPopup(`${html}
`, 'text');
+ } catch (error) {
+ toastr.error('Error loading extensions. See browser console for details.');
+ console.error(error);
+ } finally {
+ hideLoader();
+ }
}