Skip to content

Commit

Permalink
Don't fail asset generation when project.json can't be parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinCampbell committed Jul 20, 2016
1 parent b5d2fd6 commit 09609e1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,17 @@ function hasWebServerDependency(targetProjectData: TargetProjectData): boolean {
let projectJson = fs.readFileSync(targetProjectData.projectJsonPath, 'utf8');
projectJson = projectJson.replace(/^\uFEFF/, '');

let projectJsonObject = JSON.parse(projectJson);

let projectJsonObject: any;

try {
// TODO: This error should be surfaced to the user. If the JSON can't be parsed
// (maybe due to a syntax error like an extra comma), the user should be notified
// to fix up their project.json.
let projectJsonObject = JSON.parse(projectJson);
} catch (error) {
return false;
}

if (projectJsonObject == null) {
return false;
}
Expand Down

0 comments on commit 09609e1

Please sign in to comment.