@@ -75,7 +75,7 @@ export class AutoCompletionService implements IAutoCompletionService {
75
75
}
76
76
} catch ( error ) {
77
77
if ( error . code !== "ENOENT" ) {
78
- this . $logger . trace ( "Error while trying to disable autocompletion for '%s' file. Error is:\n%s" , error ) ;
78
+ this . $logger . trace ( "Error while trying to disable autocompletion for '%s' file. Error is:\n%s" , error . toString ( ) ) ;
79
79
}
80
80
}
81
81
} ) ;
@@ -148,9 +148,13 @@ export class AutoCompletionService implements IAutoCompletionService {
148
148
149
149
private isNewAutoCompletionEnabledInFile ( fileName : string ) : IFuture < boolean > {
150
150
return ( ( ) : boolean => {
151
- var data = this . $fs . readText ( fileName ) . wait ( ) ;
152
- if ( data && data . indexOf ( this . completionShellScriptContent ) !== - 1 ) {
153
- return true ;
151
+ try {
152
+ var data = this . $fs . readText ( fileName ) . wait ( ) ;
153
+ if ( data && data . indexOf ( this . completionShellScriptContent ) !== - 1 ) {
154
+ return true ;
155
+ }
156
+ } catch ( err ) {
157
+ this . $logger . trace ( "Error while checking is autocompletion enabled in file %s. Error is: '%s'" , fileName , err . toString ( ) ) ;
154
158
}
155
159
156
160
return false ;
@@ -159,8 +163,12 @@ export class AutoCompletionService implements IAutoCompletionService {
159
163
160
164
private isObsoleteAutoCompletionEnabledInFile ( fileName : string ) : IFuture < boolean > {
161
165
return ( ( ) => {
162
- var text = this . $fs . readText ( fileName ) . wait ( ) ;
163
- return text . match ( this . getTabTabObsoleteRegex ( this . $staticConfig . CLIENT_NAME ) ) || text . match ( this . getTabTabObsoleteRegex ( this . $staticConfig . CLIENT_NAME ) ) ;
166
+ try {
167
+ var text = this . $fs . readText ( fileName ) . wait ( ) ;
168
+ return text . match ( this . getTabTabObsoleteRegex ( this . $staticConfig . CLIENT_NAME ) ) || text . match ( this . getTabTabObsoleteRegex ( this . $staticConfig . CLIENT_NAME ) ) ;
169
+ } catch ( err ) {
170
+ this . $logger . trace ( "Error while checking is obsolete autocompletion enabled in file %s. Error is: '%s'" , fileName , err . toString ( ) ) ;
171
+ }
164
172
} ) . future < boolean > ( ) ( ) ;
165
173
}
166
174
@@ -232,7 +240,7 @@ export class AutoCompletionService implements IAutoCompletionService {
232
240
}
233
241
} catch ( err ) {
234
242
this . $logger . out ( "Failed to update %s. Auto-completion may not work. " , filePath ) ;
235
- this . $logger . out ( err ) ;
243
+ this . $logger . trace ( err ) ;
236
244
this . scriptsOk = false ;
237
245
}
238
246
} ) . future < void > ( ) ( ) ;
0 commit comments