File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { dialog } from "electron/main" ;
1
2
import fs from "node:fs" ;
2
3
import path from "node:path" ;
3
4
import process from "node:process" ;
@@ -6,6 +7,7 @@ import {z} from "zod";
6
7
7
8
import { enterpriseConfigSchemata } from "./config-schemata.js" ;
8
9
import Logger from "./logger-util.js" ;
10
+ import * as Messages from "./messages.js" ;
9
11
10
12
type EnterpriseConfig = {
11
13
[ Key in keyof typeof enterpriseConfigSchemata ] : z . output <
@@ -40,6 +42,8 @@ function reloadDatabase(): void {
40
42
. partial ( )
41
43
. parse ( data ) ;
42
44
} catch ( error : unknown ) {
45
+ const { title, content} = Messages . enterpriseInvalidJson ( enterpriseFile ) ;
46
+ dialog . showErrorBox ( title , content ) ;
43
47
logger . log ( "Error while JSON parsing global_config.json: " ) ;
44
48
logger . log ( error ) ;
45
49
}
Original file line number Diff line number Diff line change @@ -36,3 +36,12 @@ export function orgRemovalError(url: string): DialogBoxError {
36
36
content : "Please contact your system administrator." ,
37
37
} ;
38
38
}
39
+
40
+ export function enterpriseInvalidJson (
41
+ pathToConfigFile : string ,
42
+ ) : DialogBoxError {
43
+ return {
44
+ title : "Invalid JSON" ,
45
+ content : `Correct the invalid JSON format in global_config.json.\nIt can be found in:\n${ pathToConfigFile } ` ,
46
+ } ;
47
+ }
You can’t perform that action at this time.
0 commit comments