From 64fc13061c2b0b37aab603de7238d6bcbbd7f618 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Sch=C3=A4fer?=
 <pschaefer@ITA.AKUSTIK.RWTH-AACHEN.DE>
Date: Wed, 1 Mar 2023 08:48:31 +0100
Subject: [PATCH] Launcher script: added a catch for json decode errors

---
 LaunchScript/VirtualAcousticsStarterServer.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/LaunchScript/VirtualAcousticsStarterServer.py b/LaunchScript/VirtualAcousticsStarterServer.py
index 21baed9..9de9775 100644
--- a/LaunchScript/VirtualAcousticsStarterServer.py
+++ b/LaunchScript/VirtualAcousticsStarterServer.py
@@ -17,8 +17,12 @@ class ErrorCodes(Enum):
 # Class representing the VA-Launcher config (.json) file
 class LauncherConfig:
   def __init__(conf, sConfigFile):
-    with open( sConfigFile ) as json_file:
-      json_config = json.load(json_file)
+    try:
+      with open( sConfigFile ) as json_file:
+        json_config = json.load(json_file)
+    except Exception as e:
+      print( "ERROR reading the json config:" + os.linesep + str(e) )
+      sys.exit( ErrorCodes.ERROR_INCOMPLETE_CONFIG )
 
     try:
       conf.dVirtualAcousticDirectories = json_config["dVAServerDirectories"]
-- 
GitLab