mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 12:15:40 +08:00
chore: address Rust 1.78 clippy lints (#4545)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -8,7 +8,7 @@ use hyperswitch_domain_models::errors::StorageError as DataStorageError;
|
||||
pub use redis_interface::errors::RedisError;
|
||||
use router_env::opentelemetry::metrics::MetricsError;
|
||||
|
||||
use crate::{errors as storage_errors, store::errors::DatabaseError};
|
||||
use crate::store::errors::DatabaseError;
|
||||
|
||||
pub type ApplicationResult<T> = Result<T, ApplicationError>;
|
||||
|
||||
@ -56,20 +56,16 @@ impl Into<DataStorageError> for &StorageError {
|
||||
fn into(self) -> DataStorageError {
|
||||
match self {
|
||||
StorageError::DatabaseError(i) => match i.current_context() {
|
||||
storage_errors::DatabaseError::DatabaseConnectionError => {
|
||||
DataStorageError::DatabaseConnectionError
|
||||
}
|
||||
DatabaseError::DatabaseConnectionError => DataStorageError::DatabaseConnectionError,
|
||||
// TODO: Update this error type to encompass & propagate the missing type (instead of generic `db value not found`)
|
||||
storage_errors::DatabaseError::NotFound => {
|
||||
DatabaseError::NotFound => {
|
||||
DataStorageError::ValueNotFound(String::from("db value not found"))
|
||||
}
|
||||
// TODO: Update this error type to encompass & propagate the duplicate type (instead of generic `db value not found`)
|
||||
storage_errors::DatabaseError::UniqueViolation => {
|
||||
DataStorageError::DuplicateValue {
|
||||
entity: "db entity",
|
||||
key: None,
|
||||
}
|
||||
}
|
||||
DatabaseError::UniqueViolation => DataStorageError::DuplicateValue {
|
||||
entity: "db entity",
|
||||
key: None,
|
||||
},
|
||||
err => DataStorageError::DatabaseError(error_stack::report!(*err)),
|
||||
},
|
||||
StorageError::ValueNotFound(i) => DataStorageError::ValueNotFound(i.clone()),
|
||||
|
||||
Reference in New Issue
Block a user