Bug 1894928 - Don't use template strings for logging console errors in the search service. r=search-reviewers,mcheang

This allows better output on the browser console and provides full stacks for exceptions.

Differential Revision: https://phabricator.services.mozilla.com/D209383
This commit is contained in:
Mark Banner 2024-05-07 21:04:58 +00:00
parent 543dd15a2c
commit 4eb0359623
2 changed files with 6 additions and 9 deletions

View file

@ -1801,9 +1801,9 @@ export class SearchService {
this.#addEngineToStore(engine);
} catch (ex) {
console.error(
`Could not load engine ${
"webExtension" in config ? config.webExtension.id : "unknown"
}: ${ex}`
"Could not load engine",
"webExtension" in config ? config.webExtension.id : "unknown",
ex
);
}
}
@ -1839,7 +1839,8 @@ export class SearchService {
});
} catch (ex) {
lazy.logConsole.error(
`#createAndAddAddonEngine failed for ${extension.id}`,
"#createAndAddAddonEngine failed for",
extension.id,
ex
);
}

View file

@ -25,11 +25,7 @@ add_setup(async function () {
add_task(async function test_install_duplicate_engine_startup() {
let name = "Plain";
let id = "plain@tests.mozilla.org";
consoleAllowList.push(
`#createAndAddAddonEngine failed for ${id}`,
`An engine called ${name} already exists`
);
consoleAllowList.push("#createAndAddAddonEngine failed for");
// Do not use SearchTestUtils.installSearchExtension, as we need to manually
// start the search service after installing the extension.
let extensionInfo = {