Update input validator errors to be standardized

This commit is contained in:
Kevin Schoonover 2020-05-30 15:09:16 -05:00
parent 009ff2d2d6
commit e96ee8a8d6
3 changed files with 7 additions and 7 deletions

View File

@ -15,7 +15,7 @@ impl InputValueValidator for IntRange {
if let Value::Int(n) = value {
if *n < self.min || *n > self.max {
Some(format!(
"the value is {}, but the range must be between {} and {}",
"the value is {}, must be between {} and {}",
*n, self.min, self.max
))
} else {
@ -80,7 +80,7 @@ impl InputValueValidator for IntNonZero {
fn is_valid(&self, value: &Value) -> Option<String> {
if let Value::Int(n) = value {
if *n == 0 {
Some(format!("the value is {}, but must be nonzero", *n,))
Some(format!("the value is {}, must be nonzero", *n,))
} else {
None
}
@ -100,7 +100,7 @@ impl InputValueValidator for IntEqual {
fn is_valid(&self, value: &Value) -> Option<String> {
if let Value::Int(n) = value {
if *n != self.value {
Some(format!("the value is {}, must be equal {}", *n, self.value))
Some(format!("the value is {}, must be equal to {}", *n, self.value))
} else {
None
}

View File

@ -12,7 +12,7 @@ impl InputValueValidator for ListMinLength {
if let Value::List(values) = value {
if values.len() < self.length as usize {
Some(format!(
"the value length is {}, but the length must be greater than or equal to {}",
"the value length is {}, must be greater than or equal to {}",
values.len(),
self.length
))
@ -36,7 +36,7 @@ impl InputValueValidator for ListMaxLength {
if let Value::List(values) = value {
if values.len() > self.length as usize {
Some(format!(
"the value length is {}, but the length must be less than or equal to {}",
"the value length is {}, must be less than or equal to {}",
values.len(),
self.length
))

View File

@ -14,7 +14,7 @@ impl InputValueValidator for StringMinLength {
if let Value::String(s) = value {
if s.len() < self.length as usize {
Some(format!(
"the value length is {}, but the length must be greater than or equal to {}",
"the value length is {}, must be greater than or equal to {}",
s.len(),
self.length
))
@ -38,7 +38,7 @@ impl InputValueValidator for StringMaxLength {
if let Value::String(s) = value {
if s.len() > self.length as usize {
Some(format!(
"the value length is {}, but the length must be less than or equal to {}",
"the value length is {}, must be less than or equal to {}",
s.len(),
self.length
))