mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat: add deep health check (#3210)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -376,3 +376,53 @@ pub enum ConnectorError {
|
||||
#[error("Missing 3DS redirection payload: {field_name}")]
|
||||
MissingConnectorRedirectionPayload { field_name: &'static str },
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum HealthCheckDBError {
|
||||
#[error("Error while connecting to database")]
|
||||
DBError,
|
||||
#[error("Error while writing to database")]
|
||||
DBWriteError,
|
||||
#[error("Error while reading element in the database")]
|
||||
DBReadError,
|
||||
#[error("Error while deleting element in the database")]
|
||||
DBDeleteError,
|
||||
#[error("Unpredictable error occurred")]
|
||||
UnknownError,
|
||||
#[error("Error in database transaction")]
|
||||
TransactionError,
|
||||
}
|
||||
|
||||
impl From<diesel::result::Error> for HealthCheckDBError {
|
||||
fn from(error: diesel::result::Error) -> Self {
|
||||
match error {
|
||||
diesel::result::Error::DatabaseError(_, _) => Self::DBError,
|
||||
|
||||
diesel::result::Error::RollbackErrorOnCommit { .. }
|
||||
| diesel::result::Error::RollbackTransaction
|
||||
| diesel::result::Error::AlreadyInTransaction
|
||||
| diesel::result::Error::NotInTransaction
|
||||
| diesel::result::Error::BrokenTransactionManager => Self::TransactionError,
|
||||
|
||||
_ => Self::UnknownError,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum HealthCheckRedisError {
|
||||
#[error("Failed to establish Redis connection")]
|
||||
RedisConnectionError,
|
||||
#[error("Failed to set key value in Redis")]
|
||||
SetFailed,
|
||||
#[error("Failed to get key value in Redis")]
|
||||
GetFailed,
|
||||
#[error("Failed to delete key value in Redis")]
|
||||
DeleteFailed,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, thiserror::Error)]
|
||||
pub enum HealthCheckLockerError {
|
||||
#[error("Failed to establish Locker connection")]
|
||||
FailedToCallLocker,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user