Skip to content

Commit 77716c6

Browse files
committed
fix: remove not needed import and better error messaging
1 parent 25913cf commit 77716c6

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

snykTask/src/__tests__/test-task-args.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ describe('TaskArgs.validate', () => {
135135
args.validate();
136136
}
137137
).toThrow(
138-
new Error('If set, severity threshold must be \'critical\' or \'high\' or \'medium\' or \'low\' (case insensitive). If not set, the default is \'low\'.')
138+
new Error('If set, severityThreshold must be \'critical\' or \'high\' or \'medium\' or \'low\' (case insensitive). If not set, the default is \'low\'.')
139139
);
140140
});
141141

snykTask/src/task-args.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as tl from 'azure-pipelines-task-lib';
22
import {
33
Severity,
4-
getSeverityOrdinal,
54
} from './task-lib';
65
export type MonitorWhen = 'never' | 'noIssuesFound' | 'always';
76
class TaskArgs {
@@ -79,14 +78,14 @@ class TaskArgs {
7978
public validate() {
8079
if (this.failOnThreshold){
8180
if (this.isNotValidThreshold(this.failOnThreshold)) {
82-
const errorMsg = `If set, fail on threshold must be '${Severity.CRITICAL}' or '${Severity.HIGH}' or '${Severity.MEDIUM}' or '${Severity.LOW}' (case insensitive). If not set, the default is 'low'.`;
81+
const errorMsg = `If set, failOnThreshold must be '${Severity.CRITICAL}' or '${Severity.HIGH}' or '${Severity.MEDIUM}' or '${Severity.LOW}' (case insensitive). If not set, the default is 'low'.`;
8382
throw new Error(errorMsg);
8483
}
8584
}
8685

8786
if (this.severityThreshold) {
8887
if (this.isNotValidThreshold(this.severityThreshold)) {
89-
const errorMsg = `If set, severity threshold must be '${Severity.CRITICAL}' or '${Severity.HIGH}' or '${Severity.MEDIUM}' or '${Severity.LOW}' (case insensitive). If not set, the default is 'low'.`;
88+
const errorMsg = `If set, severityThreshold must be '${Severity.CRITICAL}' or '${Severity.HIGH}' or '${Severity.MEDIUM}' or '${Severity.LOW}' (case insensitive). If not set, the default is 'low'.`;
9089
throw new Error(errorMsg);
9190
}
9291
}

0 commit comments

Comments
 (0)