diff --git a/src/route/contact/errors.rs b/src/route/contact/errors.rs index db03bd0..b5b7e2c 100644 --- a/src/route/contact/errors.rs +++ b/src/route/contact/errors.rs @@ -89,15 +89,16 @@ impl std::fmt::Display for ContactError { /// If no specific field can be identified, returns a generic `ValidationError`. impl From for ContactError { fn from(value: ValidationErrors) -> Self { - if validator::ValidationErrors::has_error(&Err(value.clone()), "name") { + let errors = value.field_errors(); + if errors.contains_key("name") { return Self::ValidationNameError("backend.contact.errors.validation.name".to_owned()); } - if validator::ValidationErrors::has_error(&Err(value.clone()), "email") { + if errors.contains_key("email") { return Self::ValidationEmailError( "backend.contact.errors.validation.email".to_owned(), ); } - if validator::ValidationErrors::has_error(&Err(value), "message") { + if errors.contains_key("message") { return Self::ValidationMessageError( "backend.contact.errors.validation.message".to_owned(), );