/
invalid-iac-file.ts
36 lines (32 loc) · 1.35 KB
/
invalid-iac-file.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import chalk from 'chalk';
import { CustomError } from './custom-error';
export function NotSupportedIacFileError(atLocations: string[]) {
const locationsStr = atLocations.join(', ');
const errorMsg =
'Not supported infrastructure as code target files in ' +
locationsStr +
'.\nPlease see our documentation for supported target files (currently we support Kubernetes files only): ' +
chalk.underline(
'https://support.snyk.io/hc/en-us/articles/360006368877-Scan-and-fix-security-issues-in-your-Kubernetes-configuration-files',
) +
' and make sure you are in the right directory.';
const error = new CustomError(errorMsg);
error.code = 422;
error.userMessage = errorMsg;
return error;
}
export function IllegalIacFileError(atLocations: string[]): CustomError {
const locationsStr = atLocations.join(', ');
const errorMsg =
'Illegal infrastructure as code target file ' +
locationsStr +
'.\nPlease see our documentation for supported target files (currently we support Kubernetes files only): ' +
chalk.underline(
'https://support.snyk.io/hc/en-us/articles/360006368877-Scan-and-fix-security-issues-in-your-Kubernetes-configuration-files',
) +
' and make sure you are in the right directory.';
const error = new CustomError(errorMsg);
error.code = 422;
error.userMessage = errorMsg;
return error;
}