autoconfig: wrap most code in try…catch

Make debugging easier by printing exceptions to the log. For example:

  main() failed: TypeError: fragment.contains is not a function
This commit is contained in:
Oliver Smith 2023-04-06 20:09:39 +00:00
parent 49e6a9866b
commit e2f29799c6
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -249,15 +249,26 @@ function css_files_update() {
set_firefox_version_previous(ff);
}
log("Running mobile-config-autoconfig.js");
function main() {
log("Running mobile-config-autoconfig.js");
css_files_update();
css_files_update();
// Restart Firefox immediately if one of the files got updated
if (updated == true)
trigger_firefox_restart();
else
set_default_prefs();
// Restart Firefox immediately if one of the files got updated
if (updated == true)
trigger_firefox_restart();
else
set_default_prefs();
log("Done");
}
log("Done");
try {
main();
} catch(e) {
log("main() failed: " + e);
// Let Firefox display the generic error message that something went wrong
// in the autoconfig script.
error;
}
logFileStream.close();