[mv3] Improve internal error reporting in troubleshooting info

This commit is contained in:
Raymond Hill 2025-08-15 08:39:35 -04:00
parent d54c4a7052
commit 25d9964b1e
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
5 changed files with 15 additions and 15 deletions

View file

@ -191,7 +191,7 @@ function onMessage(request, sender, callback) {
origin: 'USER', origin: 'USER',
target: { tabId, frameIds: [ frameId ] }, target: { tabId, frameIds: [ frameId ] },
}).catch(reason => { }).catch(reason => {
ubolErr(reason); ubolErr(`insertCSS/${reason}`);
}); });
return false; return false;
} }
@ -203,7 +203,7 @@ function onMessage(request, sender, callback) {
origin: 'USER', origin: 'USER',
target: { tabId, frameIds: [ frameId ] }, target: { tabId, frameIds: [ frameId ] },
}).catch(reason => { }).catch(reason => {
ubolErr(reason); ubolErr(`removeCSS/${reason}`);
}); });
return false; return false;
} }
@ -242,7 +242,7 @@ function onMessage(request, sender, callback) {
target: { tabId, frameIds: [ frameId ] }, target: { tabId, frameIds: [ frameId ] },
injectImmediately: true, injectImmediately: true,
}).catch(reason => { }).catch(reason => {
ubolErr(reason); ubolErr(`executeScript/${reason}`);
}).then(( ) => { }).then(( ) => {
callback(); callback();
}); });

View file

@ -27,7 +27,7 @@ function fetchJSON(path) {
return fetch(`${path}.json`).then(response => return fetch(`${path}.json`).then(response =>
response.json() response.json()
).catch(reason => { ).catch(reason => {
ubolErr(reason); ubolErr(`fetchJSON/${reason}`);
}); });
} }

View file

@ -85,7 +85,7 @@ export function startCustomFilters(tabId, frameId) {
target: { tabId, frameIds: [ frameId ] }, target: { tabId, frameIds: [ frameId ] },
injectImmediately: true, injectImmediately: true,
}).catch(reason => { }).catch(reason => {
ubolErr(reason); ubolErr(`startCustomFilters/${reason}`);
}) })
} }
@ -95,7 +95,7 @@ export function terminateCustomFilters(tabId, frameId) {
target: { tabId, frameIds: [ frameId ] }, target: { tabId, frameIds: [ frameId ] },
injectImmediately: true, injectImmediately: true,
}).catch(reason => { }).catch(reason => {
ubolErr(reason); ubolErr(`terminateCustomFilters/${reason}`);
}) })
} }
@ -113,7 +113,7 @@ export async function injectCustomFilters(tabId, frameId, hostname) {
origin: 'USER', origin: 'USER',
target: { tabId, frameIds: [ frameId ] }, target: { tabId, frameIds: [ frameId ] },
}).catch(reason => { }).catch(reason => {
ubolErr(reason); ubolErr(`injectCustomFilters/insertCSS/${reason}`);
}) })
); );
} }
@ -125,7 +125,7 @@ export async function injectCustomFilters(tabId, frameId, hostname) {
target: { tabId, frameIds: [ frameId ] }, target: { tabId, frameIds: [ frameId ] },
injectImmediately: true, injectImmediately: true,
}).catch(reason => { }).catch(reason => {
ubolErr(reason); ubolErr(`injectCustomFilters/executeScript/${reason}`);
}) })
); );
} }

View file

@ -318,7 +318,7 @@ async function updateDynamicRules() {
ubolLog(`Add ${addRules.length} dynamic DNR rules`); ubolLog(`Add ${addRules.length} dynamic DNR rules`);
} }
} catch(reason) { } catch(reason) {
ubolErr(`updateDynamicRules() / ${reason}`); ubolErr(`updateDynamicRules/${reason}`);
response.error = `${reason}`; response.error = `${reason}`;
} }
@ -472,7 +472,7 @@ async function updateSessionRules() {
ubolLog(`Add ${addRules.length} session DNR rules`); ubolLog(`Add ${addRules.length} session DNR rules`);
} }
} catch(reason) { } catch(reason) {
ubolErr(`updateSessionRules() / ${reason}`); ubolErr(`updateSessionRules/${reason}`);
response.error = `${reason}`; response.error = `${reason}`;
} }
return response; return response;
@ -667,7 +667,7 @@ async function enableRulesets(ids) {
enableRulesetIds, enableRulesetIds,
disableRulesetIds, disableRulesetIds,
}).catch(reason => { }).catch(reason => {
ubolErr(reason); ubolErr(`updateEnabledRulesets/${reason}`);
response.error = `${reason}`; response.error = `${reason}`;
}); });
@ -684,7 +684,7 @@ async function enableRulesets(ids) {
ubolLog(`Available static rule count: ${count}`); ubolLog(`Available static rule count: ${count}`);
response.staticRuleCount = count; response.staticRuleCount = count;
}).catch(reason => { }).catch(reason => {
ubolErr(reason); ubolErr(`getEnabledRulesets/${reason}`);
}); });
return response; return response;
@ -781,7 +781,7 @@ async function updateUserRules() {
out.added = addRules.length; out.added = addRules.length;
out.removed = removeRuleIds.length; out.removed = removeRuleIds.length;
} catch(reason) { } catch(reason) {
ubolErr(`updateUserRules() / ${reason}`); ubolErr(`updateUserRules/${reason}`);
out.errors.push(`${reason}`); out.errors.push(`${reason}`);
} finally { } finally {
const userRules = await getEffectiveUserRules(); const userRules = await getEffectiveUserRules();

View file

@ -551,7 +551,7 @@ async function registerInjectables() {
await browser.scripting.unregisterContentScripts({ ids: toRemove }); await browser.scripting.unregisterContentScripts({ ids: toRemove });
localRemove('$scripting.unregisterContentScripts'); localRemove('$scripting.unregisterContentScripts');
} catch(reason) { } catch(reason) {
ubolErr(reason); ubolErr(`unregisterContentScripts/${reason}`);
} }
} }
@ -561,7 +561,7 @@ async function registerInjectables() {
await browser.scripting.registerContentScripts(toAdd); await browser.scripting.registerContentScripts(toAdd);
localRemove('$scripting.registerContentScripts'); localRemove('$scripting.registerContentScripts');
} catch(reason) { } catch(reason) {
ubolErr(reason); ubolErr(`registerContentScripts/${reason}`);
} }
} }