Improve regex validator error message to be descriptive

This commit is contained in:
Douman 2021-12-21 13:48:02 +09:00
parent 0dedc8dca2
commit 988dcb7d21

View File

@ -9,7 +9,7 @@ pub fn regex<T: AsRef<str> + InputType>(
if let Ok(true) = Regex::new(regex).map(|re| re.is_match(value.as_ref())) {
Ok(())
} else {
Err("value is valid".into())
Err("value doesn't match expected format".into())
}
}