mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-31 01:57:45 +08:00
refactor(redis_interface): separating redis functionality and dependent functionalities outside router crate (#15)
Co-authored-by: Sanchith Hegde
This commit is contained in:
@ -5,15 +5,15 @@ pub(crate) mod utils;
|
||||
use std::fmt::Display;
|
||||
|
||||
use actix_web::{body::BoxBody, http::StatusCode, HttpResponse, ResponseError};
|
||||
pub use common_utils::errors::{CustomResult, ParsingError};
|
||||
use config::ConfigError;
|
||||
use error_stack;
|
||||
pub use redis_interface::errors::RedisError;
|
||||
use router_env::opentelemetry::metrics::MetricsError;
|
||||
|
||||
pub use self::api_error_response::ApiErrorResponse;
|
||||
pub(crate) use self::utils::{ApiClientErrorExt, ConnectorErrorExt, StorageErrorExt};
|
||||
use crate::services;
|
||||
|
||||
pub type CustomResult<T, E> = error_stack::Result<T, E>;
|
||||
pub type RouterResult<T> = CustomResult<T, ApiErrorResponse>;
|
||||
pub type RouterResponse<T> = CustomResult<services::BachResponse<T>, ApiErrorResponse>;
|
||||
|
||||
@ -97,7 +97,6 @@ pub enum DatabaseError {
|
||||
impl_error_type!(AuthenticationError, "Authentication error");
|
||||
impl_error_type!(AuthorisationError, "Authorisation error");
|
||||
impl_error_type!(EncryptionError, "Encryption error");
|
||||
impl_error_type!(ParsingError, "Parsing error");
|
||||
impl_error_type!(UnexpectedError, "Unexpected error");
|
||||
impl_error_type!(ValidateError, "validation failed");
|
||||
|
||||
@ -418,42 +417,6 @@ error_to_process_tracker_error!(
|
||||
ProcessTrackerError::EValidationError(error_stack::Report<ValidationError>)
|
||||
);
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum RedisError {
|
||||
#[error("Failed to set key value in Redis")]
|
||||
SetFailed,
|
||||
#[error("Failed to set key value with expiry in Redis")]
|
||||
SetExFailed,
|
||||
#[error("Failed to set expiry for key value in Redis")]
|
||||
SetExpiryFailed,
|
||||
#[error("Failed to get key value in Redis")]
|
||||
GetFailed,
|
||||
#[error("Failed to delete key value in Redis")]
|
||||
DeleteFailed,
|
||||
#[error("Failed to append entry to redis stream")]
|
||||
StreamAppendFailed,
|
||||
#[error("Failed to read entries from redis stream")]
|
||||
StreamReadFailed,
|
||||
#[error("Failed to delete entries from redis stream")]
|
||||
StreamDeleteFailed,
|
||||
#[error("Failed to acknowledge redis stream entry")]
|
||||
StreamAcknowledgeFailed,
|
||||
#[error("Failed to create redis consumer group")]
|
||||
ConsumerGroupCreateFailed,
|
||||
#[error("Failed to destroy redis consumer group")]
|
||||
ConsumerGroupDestroyFailed,
|
||||
#[error("Failed to delete consumer from consumer group")]
|
||||
ConsumerGroupRemoveConsumerFailed,
|
||||
#[error("Failed to set last ID on consumer group")]
|
||||
ConsumerGroupSetIdFailed,
|
||||
#[error("Failed to set redis stream message owner")]
|
||||
ConsumerGroupClaimFailed,
|
||||
#[error("Failed to serialize application type to json")]
|
||||
JsonSerializationFailed,
|
||||
#[error("Failed to deserialize application type from json")]
|
||||
JsonDeserializationFailed,
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum ValidationError {
|
||||
#[error("Missing required field: {field_name}")]
|
||||
|
||||
Reference in New Issue
Block a user