Print better error messages if project.json fails to parse

This commit is contained in:
Pranav K 2016-05-31 15:01:57 -07:00
parent 0e4d154134
commit 6e8a5ad1e9
1 changed files with 10 additions and 1 deletions

View File

@ -855,7 +855,16 @@ functions
static void GetDependencies(string projectJsonPath, HashSet<string> dependencies)
{
var project = (JsonObject)Json.Deserialize(File.ReadAllText(projectJsonPath));
JsonObject project;
try
{
project = (JsonObject)Json.Deserialize(File.ReadAllText(projectJsonPath));
}
catch (Exception ex)
{
Console.Error.WriteLine("Failed to parse project at path " + projectJsonPath + Environment.NewLine + ex.Message);
throw;
}
var dependenciesNode = project.ValueAsJsonObject("dependencies");
AddKeys(dependencies, dependenciesNode);