mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
refactor(drainer): removed router dependency from drainer (#209)
This commit is contained in:
@ -1,19 +1,26 @@
|
||||
use redis_interface as redis;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DrainerError {
|
||||
#[error("Error in parsing config : {0}")]
|
||||
ConfigParsingError(String),
|
||||
#[error("Error fetching stream length for stream : {0}")]
|
||||
StreamGetLengthError(String),
|
||||
#[error("Error reading from stream : {0}")]
|
||||
StreamReadError(String),
|
||||
#[error("Error triming from stream: {0}")]
|
||||
StreamTrimFailed(String),
|
||||
#[error("No entries found for stream: {0}")]
|
||||
NoStreamEntry(String),
|
||||
#[error("Error in making stream: {0} available")]
|
||||
DeleteKeyFailed(String),
|
||||
#[error("Error during redis operation : {0}")]
|
||||
RedisError(error_stack::Report<redis::errors::RedisError>),
|
||||
#[error("Application configuration error: {0}")]
|
||||
ConfigurationError(config::ConfigError),
|
||||
}
|
||||
|
||||
pub type DrainerResult<T> = error_stack::Result<T, DrainerError>;
|
||||
|
||||
impl From<config::ConfigError> for DrainerError {
|
||||
fn from(err: config::ConfigError) -> Self {
|
||||
Self::ConfigurationError(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<error_stack::Report<redis::errors::RedisError>> for DrainerError {
|
||||
fn from(err: error_stack::Report<redis::errors::RedisError>) -> Self {
|
||||
Self::RedisError(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user