Skip to content

Commit

Permalink
Do not allow 0 concurrent scans in config
Browse files Browse the repository at this point in the history
Also unify the error messages if verify() finds invalid values
  • Loading branch information
jtt committed Oct 27, 2021
1 parent 1c5df26 commit 3845ac1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,14 +618,21 @@ impl Config {
if self.timeout.is_none() {
missing_fields.push(ARG_TIMEOUT);
}
if self.concurrent_scans.is_none() {
if let Some(c) = self.concurrent_scans {
if c == 0 {
return Err(Error::Message(format!(
"invalid value for {}: Value needs to be non-zero",
ARG_CONCURRENT_SCANS
)));
}
} else {
missing_fields.push(ARG_CONCURRENT_SCANS);
}
if let Some(c) = self.try_count {
if c == 0 {
return Err(Error::Message(format!(
"Invalid {} {}, expecting non-zero positive count",
ARG_TRY_COUNT, c
"invalid value for {}: value needs to be non-zero",
ARG_TRY_COUNT
)));
}
} else {
Expand Down

0 comments on commit 3845ac1

Please sign in to comment.