File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 2
2
"use strict" ;
3
3
4
4
import path = require( "path" ) ;
5
+ import os = require( "os" ) ;
5
6
6
7
export class ProjectData implements IProjectData {
7
8
public projectDir : string ;
@@ -28,8 +29,16 @@ export class ProjectData implements IProjectData {
28
29
this . projectFilePath = path . join ( projectDir , this . $staticConfig . PROJECT_FILE_NAME ) ;
29
30
30
31
if ( this . $fs . exists ( this . projectFilePath ) . wait ( ) ) {
32
+ try {
31
33
var fileContent = this . $fs . readJson ( this . projectFilePath ) . wait ( ) ;
32
34
this . projectId = fileContent . id ;
35
+ } catch ( err ) {
36
+ this . $errors . fail ( { formatStr : "The project file %s is corrupted." + os . EOL +
37
+ "Consider restoring an earlier version from your source control or backup." + os . EOL +
38
+ "Additional technical info: %s" ,
39
+ suppressCommandHelp : true } ,
40
+ this . projectFilePath , err . toString ( ) ) ;
41
+ }
33
42
}
34
43
} else {
35
44
this . $errors . fail ( "No project found at or above '%s' and neither was a --path specified." , process . cwd ( ) ) ;
You can’t perform that action at this time.
0 commit comments