Skip to content

Commit b6288ae

Browse files
Display error to user when we fail to parse their project.json file
1 parent 937f2d9 commit b6288ae

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/assets.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,10 @@ export class AssetGenerator {
139139
let projectJsonObject: any;
140140

141141
try {
142-
// TODO: This error should be surfaced to the user. If the JSON can't be parsed
143-
// (maybe due to a syntax error like an extra comma), the user should be notified
144-
// to fix up their project.json.
145142
projectJsonObject = tolerantParse(projectFileText);
146-
} catch (error) {
143+
}
144+
catch (error) {
145+
vscode.window.showErrorMessage('Failed to parse project.json file');
147146
projectJsonObject = null;
148147
}
149148

@@ -360,13 +359,11 @@ function getBuildOperations(tasksJsonPath: string) {
360359

361360
let buildTask: tasks.TaskDescription;
362361

363-
try
364-
{
362+
try {
365363
const tasksJson: tasks.TaskConfiguration = tolerantParse(text);
366364
buildTask = tasksJson.tasks.find(td => td.taskName === 'build');
367365
}
368-
catch (error)
369-
{
366+
catch (error) {
370367
vscode.window.showErrorMessage(`Failed to parse tasks.json file`);
371368
buildTask = undefined;
372369
}

0 commit comments

Comments
 (0)