refactor: extract email validation and PII utils to common_utils crate (#72)

This commit is contained in:
Sanchith Hegde
2022-12-06 15:19:46 +05:30
committed by GitHub
parent ab5988e6ba
commit cbbba37909
12 changed files with 202 additions and 156 deletions

View File

@ -5,7 +5,7 @@ pub(crate) mod utils;
use std::fmt::Display;
use actix_web::{body::BoxBody, http::StatusCode, HttpResponse, ResponseError};
pub use common_utils::errors::{CustomResult, ParsingError};
pub use common_utils::errors::{CustomResult, ParsingError, ValidationError};
use config::ConfigError;
use error_stack;
pub use redis_interface::errors::RedisError;
@ -409,16 +409,6 @@ error_to_process_tracker_error!(
ProcessTrackerError::EValidationError(error_stack::Report<ValidationError>)
);
#[derive(Debug, thiserror::Error)]
pub enum ValidationError {
#[error("Missing required field: {field_name}")]
MissingRequiredField { field_name: String },
#[error("Incorrect value provided for field: {field_name}")]
IncorrectValueProvided { field_name: &'static str },
#[error("{message}")]
InvalidValue { message: String },
}
#[derive(Debug, thiserror::Error)]
pub enum WebhooksFlowError {
#[error("Merchant webhook config not found")]