Include regex within validator

This commit is contained in:
Douman 2021-12-21 14:34:57 +09:00
parent 988dcb7d21
commit 2d8b22ce65

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 doesn't match expected format".into())
Err(format_args!("value doesn't match expected format: {}", regex).into())
}
}