diff --git a/app/common/enterprise-util.ts b/app/common/enterprise-util.ts index 3724e0381..87fff3eff 100644 --- a/app/common/enterprise-util.ts +++ b/app/common/enterprise-util.ts @@ -1,3 +1,4 @@ +import {dialog} from "electron/main"; import fs from "node:fs"; import path from "node:path"; import process from "node:process"; @@ -6,6 +7,7 @@ import {z} from "zod"; import {enterpriseConfigSchemata} from "./config-schemata.js"; import Logger from "./logger-util.js"; +import * as Messages from "./messages.js"; type EnterpriseConfig = { [Key in keyof typeof enterpriseConfigSchemata]: z.output< @@ -40,6 +42,8 @@ function reloadDatabase(): void { .partial() .parse(data); } catch (error: unknown) { + const {title, content} = Messages.enterpriseInvalidJson(enterpriseFile); + dialog.showErrorBox(title, content); logger.log("Error while JSON parsing global_config.json: "); logger.log(error); } diff --git a/app/common/messages.ts b/app/common/messages.ts index 545b0991d..3c29b6e95 100644 --- a/app/common/messages.ts +++ b/app/common/messages.ts @@ -36,3 +36,12 @@ export function orgRemovalError(url: string): DialogBoxError { content: "Please contact your system administrator.", }; } + +export function enterpriseInvalidJson( + pathToConfigFile: string, +): DialogBoxError { + return { + title: "Invalid JSON", + content: `Correct the invalid JSON format in global_config.json.\nIt can be found in:\n${pathToConfigFile}`, + }; +}