File tree Expand file tree Collapse file tree 1 file changed +25
-13
lines changed
src/typescript/worker/lib Expand file tree Collapse file tree 1 file changed +25
-13
lines changed Original file line number Diff line number Diff line change @@ -30,20 +30,32 @@ export function invalidateDiagnostics(): void {
3030
3131export function getDiagnosticsOfProgram ( program : ts . Program | ts . BuilderProgram ) : ts . Diagnostic [ ] {
3232 const programDiagnostics : ts . Diagnostic [ ] = [ ] ;
33-
34- if ( config . diagnosticOptions . syntactic ) {
35- programDiagnostics . push ( ...program . getSyntacticDiagnostics ( ) ) ;
36- }
37- if ( config . diagnosticOptions . global ) {
38- programDiagnostics . push ( ...program . getGlobalDiagnostics ( ) ) ;
39- }
40- if ( config . diagnosticOptions . semantic ) {
41- programDiagnostics . push ( ...program . getSemanticDiagnostics ( ) ) ;
42- }
43- if ( config . diagnosticOptions . declaration ) {
44- programDiagnostics . push ( ...program . getDeclarationDiagnostics ( ) ) ;
33+ try {
34+ if ( config . diagnosticOptions . syntactic ) {
35+ programDiagnostics . push ( ...program . getSyntacticDiagnostics ( ) ) ;
36+ }
37+ if ( config . diagnosticOptions . global ) {
38+ programDiagnostics . push ( ...program . getGlobalDiagnostics ( ) ) ;
39+ }
40+ if ( config . diagnosticOptions . semantic ) {
41+ programDiagnostics . push ( ...program . getSemanticDiagnostics ( ) ) ;
42+ }
43+ if ( config . diagnosticOptions . declaration ) {
44+ programDiagnostics . push ( ...program . getDeclarationDiagnostics ( ) ) ;
45+ }
46+ } catch ( e ) {
47+ if ( e instanceof Error ) {
48+ programDiagnostics . push ( {
49+ code : 1 ,
50+ category : 1 ,
51+ messageText : `TSC compiler crashed: ${ e . message }
52+ ${ e . stack } `,
53+ file : undefined ,
54+ start : undefined ,
55+ length : undefined ,
56+ } ) ;
57+ }
4558 }
46-
4759 return programDiagnostics ;
4860}
4961
You can’t perform that action at this time.
0 commit comments