File tree Expand file tree Collapse file tree 5 files changed +18
-4
lines changed Expand file tree Collapse file tree 5 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 2
2
# Each line is a file pattern followed by one or more owners
3
3
4
4
# Specify the default owners for the entire repository
5
- * @ OrShamirCM @ AlvoBen @ pedrompflopes
5
+ * @ OrShamirCM @ AlvoBen @ pedrompflopes @ miryamfoiferCX
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import {logger} from '../wrapper/loggerConfig';
2
2
import * as fs from 'fs' ;
3
3
import { finished } from 'stream/promises' ;
4
4
import { Client } from "./Client" ;
5
+ import { CxError } from "../errors/CxError" ;
5
6
6
7
export class AstClient {
7
8
private client : Client ;
@@ -20,10 +21,9 @@ export class AstClient {
20
21
logger . info ( `Download completed successfully. File saved to: ${ outputPath } ` ) ;
21
22
} catch ( error ) {
22
23
logger . error ( `Error downloading file from ${ url } : ${ error . message || error } ` ) ;
23
- throw error ;
24
+ throw new CxError ( error . message || error ) ;
24
25
} finally {
25
26
writer . close ( ) ;
26
- logger . info ( 'Write stream closed.' ) ;
27
27
}
28
28
}
29
29
}
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import {Client} from "./Client";
4
4
5
5
export class HttpClient implements Client {
6
6
private readonly axiosConfig : AxiosRequestConfig ;
7
+ private readonly domainErrMsg = 'Unable to download the CLI from the URL. Try adding the domain: \'download.checkmarx.com\' to your allow list.' ;
7
8
8
9
constructor ( ) {
9
10
this . axiosConfig = {
@@ -45,6 +46,9 @@ export class HttpClient implements Client {
45
46
return response ;
46
47
} catch ( error ) {
47
48
logger . error ( `Error sending ${ method } request to ${ url } : ${ error . message || error } ` ) ;
49
+ if ( this . axiosConfig . proxy !== undefined ) {
50
+ throw new Error ( `${ this . domainErrMsg } \nError: ${ error . message || error } ` ) ;
51
+ }
48
52
throw error ;
49
53
}
50
54
}
Original file line number Diff line number Diff line change
1
+ export class CxError extends Error {
2
+ constructor ( message : string ) {
3
+ super ( message ) ;
4
+ this . name = "CxError" ;
5
+ }
6
+ }
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import * as tar from 'tar';
5
5
import * as unzipper from 'unzipper' ;
6
6
import { logger } from "../wrapper/loggerConfig" ;
7
7
import { AstClient } from "../client/AstClient" ;
8
+ import { CxError } from "../errors/CxError" ;
8
9
9
10
const linuxOS = 'linux' ;
10
11
const macOS = 'darwin' ;
@@ -41,7 +42,7 @@ export class CxInstaller {
41
42
const platformData = CxInstaller . PLATFORMS [ this . platform ] ;
42
43
43
44
if ( ! platformData ) {
44
- throw new Error ( 'Unsupported platform or architecture' ) ;
45
+ throw new CxError ( 'Unsupported platform or architecture' ) ;
45
46
}
46
47
47
48
const architecture = this . getArchitecture ( ) ;
@@ -103,6 +104,9 @@ export class CxInstaller {
103
104
logger . info ( 'Extracted CLI to:' , this . resourceDirPath ) ;
104
105
} catch ( error ) {
105
106
logger . error ( 'Error during installation:' , error ) ;
107
+ if ( error instanceof CxError ) {
108
+ process . exit ( 1 ) ;
109
+ }
106
110
}
107
111
}
108
112
You can’t perform that action at this time.
0 commit comments