Add warning dialog when custom config.json is invalid

Signed-off-by: Aaron Raimist <aaron@raim.ist>
This commit is contained in:
Aaron Raimist 2021-06-03 23:39:29 -05:00
parent 7f28e3f1e2
commit bc0e3bb317
No known key found for this signature in database
GPG key ID: 37419210002890EF
2 changed files with 12 additions and 0 deletions

View file

@ -207,6 +207,16 @@ async function setupGlobals() {
vectorConfig = Object.assign(vectorConfig, localConfig);
} catch (e) {
if (e instanceof SyntaxError) {
dialog.showMessageBox({
type: "error",
title: _t("Your %(brand)s is misconfigured", { brand: vectorConfig.brand || 'Element'}),
message: _t("Your custom %(brand)s configuration contains invalid JSON. " +
"Please correct the problem and reopen %(brand)s.", { brand: vectorConfig.brand || 'Element'}),
detail: e.message || "",
});
}
// Could not load local config, this is expected in most cases.
}

View file

@ -1,4 +1,6 @@
{
"Your %(brand)s is misconfigured": "Your %(brand)s is misconfigured",
"Your custom %(brand)s configuration contains invalid JSON. Please correct the problem and reopen %(brand)s.": "Your custom %(brand)s configuration contains invalid JSON. Please correct the problem and reopen %(brand)s.",
"Cancel": "Cancel",
"Close Element": "Close Element",
"Are you sure you want to quit?": "Are you sure you want to quit?",