Improve error messages for extension script errors

Browsers won't tell us any specifics, but the console will let the user find out what happened.
This commit is contained in:
GarboMuffin committed 2022-10-29 22:58:15 -05:00
1 parent ae7526f156
commit d2dbf86035
2 files changed
+6 -2

No files matched your search

+3 -1
View File
@@ -14,7 +14,9 @@ const loadScripts = url => {
return new Promise((resolve, reject) => {
const script = document.createElement('script');
script.onload = () => resolve();
script.onerror = () => reject(new Error(`Error when loading custom extension script: ${url}`));
script.onerror = () => {
reject(new Error(`Error in sandboxed script: ${url}. Check the console for more information.`));
};
script.src = url;
document.body.appendChild(script);
});
@@ -49,7 +49,9 @@ const loadUnsandboxedExtension = (extensionURL, vm) => new Promise((resolve, rej
createUnsandboxedExtensionAPI(vm).then(resolve);
const script = document.createElement('script');
script.onerror = () => reject(new Error(`Error in unsandboxed script ${extensionURL}`));
script.onerror = () => {
reject(new Error(`Error in unsandboxed script ${extensionURL}. Check the console for more information.`));
};
script.src = extensionURL;
document.body.appendChild(script);
}).then(objects => {