2
0
Эх сурвалжийг харах

prevent silent error when some props.json config has syntax error

Nicolas Cannasse 6 жил өмнө
parent
commit
e9565b4ee2
2 өөрчлөгдсөн 7 нэмэгдсэн , 2 устгасан
  1. 1 1
      hide/Config.hx
  2. 6 1
      hide/Ide.hx

+ 1 - 1
hide/Config.hx

@@ -40,7 +40,7 @@ class Config {
 		this.path = path;
 		var fullPath = ide.getPath(path);
 		if( sys.FileSystem.exists(fullPath) )
-			source = ide.parseJSON(sys.io.File.getContent(fullPath))
+			source = try ide.parseJSON(sys.io.File.getContent(fullPath)) catch( e : Dynamic ) throw e+" (in "+fullPath+")";
 		else
 			source = cast {};
 		sync();

+ 6 - 1
hide/Ide.hx

@@ -477,7 +477,12 @@ class Ide {
 			config.global.save();
 		}
 		window.title = (isCDB ? "CastleDB" : "HIDE") + " - " + dir;
-		config = Config.loadForProject(projectDir, resourceDir);
+		try {
+			config = Config.loadForProject(projectDir, resourceDir);
+		} catch( e : Dynamic ) {
+			js.Browser.alert(e);
+			return;
+		}
 		shaderLoader = new hide.tools.ShaderLoader();
 		typesCache = new hide.tools.TypesCache();