@@ -12,7 +12,6 @@ import { ProgressOptions } from 'vscode';
1212import  {  ILoggerService  }  from  './logger-service' ; 
1313import  {  getScanTypeDisplayName  }  from  '../constants' ; 
1414import  statusBar  from  '../utils/status-bar' ; 
15- import  {  TrayNotificationTexts  }  from  '../utils/texts' ; 
1615import  {  captureException  }  from  '../sentry' ; 
1716import  {  CliIgnoreType  }  from  '../cli/models/cli-ignore-type' ; 
1817import  {  IScanResultsService  }  from  './scan-results-service' ; 
@@ -47,19 +46,15 @@ export class CycodeService implements ICycodeService {
4746    await  vscode . window . withProgress ( 
4847      options , 
4948      async  ( progress : ProgressBar ,  cancellationToken : vscode . CancellationToken )  =>  { 
50-         progress . report ( {  message } ) ; 
5149        try  { 
52-           statusBar . showScanningInProgress ( ) ; 
50+           progress . report ( {  message  } ) ; 
5351          await  fn ( cancellationToken ) ; 
54-           statusBar . showScanComplete ( ) ; 
5552        }  catch  ( error : unknown )  { 
5653          captureException ( error ) ; 
5754          if  ( error  instanceof  Error )  { 
5855            this . logger . error ( `Error during progress: ${ error . message }  ) ; 
56+             vscode . window . showErrorMessage ( `Cycode error: ${ error . message }  ) ; 
5957          } 
60- 
61-           statusBar . showScanError ( ) ; 
62-           vscode . window . showErrorMessage ( TrayNotificationTexts . ScanError ) ; 
6358        }  finally  { 
6459          progress . report ( {  increment : 100  } ) ; 
6560        } 
@@ -121,19 +116,22 @@ export class CycodeService implements ICycodeService {
121116    } ; 
122117
123118    const  scanMethod  =  scanMethods [ scanType ] ; 
124-     if  ( scanMethod )  { 
125-       await  this . withProgressBar ( 
126-         `Cycode is scanning files for ${ getScanTypeDisplayName ( scanType ) }  , 
127-         async  ( cancellationToken : vscode . CancellationToken )  =>  { 
128-           this . logger . debug ( `[${ scanType } ${ paths }  ) ; 
129-           await  scanMethod ( cancellationToken ) ; 
130-           this . logger . debug ( `[${ scanType } ${ paths }  ) ; 
131-         } , 
132-         this . getScanProgressBarOptions ( onDemand ) , 
133-       ) ; 
134-     }  else  { 
119+     if  ( ! scanMethod )  { 
135120      this . logger . error ( `Unknown scan type: ${ scanType }  ) ; 
121+       return ; 
136122    } 
123+ 
124+     await  this . withProgressBar ( 
125+       `Cycode is scanning files for ${ getScanTypeDisplayName ( scanType ) }  , 
126+       async  ( cancellationToken : vscode . CancellationToken )  =>  { 
127+         this . logger . debug ( `[${ scanType } ${ paths }  ) ; 
128+         statusBar . showScanningInProgress ( ) ; 
129+         await  scanMethod ( cancellationToken ) ; 
130+         statusBar . showScanComplete ( ) ; 
131+         this . logger . debug ( `[${ scanType } ${ paths }  ) ; 
132+       } , 
133+       this . getScanProgressBarOptions ( onDemand ) , 
134+     ) ; 
137135  } 
138136
139137  private  async  applyDetectionIgnoreInUi ( ignoreType : CliIgnoreType ,  value : string )  { 
0 commit comments